Table of Contents
PHP lacks a native enumerated type; this was our best attempt to provide one.
Enum classes are used to represent set types of things, for instance, if we created a class to represent different operating systems, it might provide enum methods like this:
<?php $unix = OperatingSystem::Unix(); $win = OperatingSystem::Windows(); $mac = OperatingSystem::Mac(); echo $unix->getName(); // prints Unix
Using this example, the OperatingSystem enum would look like this:
<?php
class OperatingSystem extends Xyster_Enum
{
const Unix = 0;
const Windows = 1;
const Mac = 2;
static public function Unix()
{ return parent::_factory(); }
static public function Windows()
{ return parent::_factory(); }
static public function Mac()
{ return parent::_factory(); }
}