EnumService (since version 2.0)
Type Service
Constants
integer DECREASING = 1
Working mode for enumStepwise.
Use it if you want an decreasing enumeration.
Use it if you want an decreasing enumeration.
integer INCREASING = 0
Working mode for enumStepwise.
Use it if you want an increasing enumeration.
Use it if you want an increasing enumeration.
Methods
Description
Enumerations are very handy to declare a sequence of constants (in a class) quickly without using fixed numbers.
In "stepwise" mode, it's possible to change the first constant number and adjust the step for each new constant found in the enumeration.
In "bitflag" mode, the constants will enumerated stepwise with a value of power of two.
But be aware... Each constant will be uppercased.
In "stepwise" mode, it's possible to change the first constant number and adjust the step for each new constant found in the enumeration.
In "bitflag" mode, the constants will enumerated stepwise with a value of power of two.
But be aware... Each constant will be uppercased.
Examples
<?php
EnumService::enumStepwise ('test1', array ('BLA', 'BLUP', 'BLUBBER'));
echo test1::BLA;
echo test1::BLUP;
echo test1::BLUBBER;
EnumService::enumBitFlags ('test2', array ('BLA', 'BLUP', 'BLUBBER'));
echo test2::BLA;
echo test2::BLUP;
echo test2::BLUBBER;
?>
EnumService::enumStepwise ('test1', array ('BLA', 'BLUP', 'BLUBBER'));
echo test1::BLA;
echo test1::BLUP;
echo test1::BLUBBER;
EnumService::enumBitFlags ('test2', array ('BLA', 'BLUP', 'BLUBBER'));
echo test2::BLA;
echo test2::BLUP;
echo test2::BLUBBER;
?>
Last change 10/17/2009