rickselby / consthelpers
1.2
2015-12-22 09:46 UTC
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2024-11-11 00:01:34 UTC
README
Helper traits to use when using a class with many constants.
Also a place for me to test CI stuff.
Example
class DataRef { use \ConstHelpers\Validating; const POINT_NORTH = 0; const POINT_SOUTH = 1; const POINT_EAST = 2; const POINT_WEST = 3; const POINT_UP = 4; const POINT_DOWN = 5; const ORIENT_NORMAL = 6; const ORIENT_INVERSE = 7; } // Get the list of constants that start with 'POINT_' $consts = DataRef::startsWith('POINT_')); // Validate a value against the constants starting with 'POINT_' if (DataRef::isValidStartsWith($value, 'POINT_')) { ... // Validate against constants matching a regular expression if (DataRef::isValid($value, '/T.*E/')) { ...