2017 © Pedro Peláez
 

library enum

PHP Enum implementation

image

esky/enum

PHP Enum implementation

  • Sunday, May 17, 2015
  • by tkolodziej
  • Repository
  • 3 Watchers
  • 2 Stars
  • 24,360 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 9 % Grown

The README.md

PHP Enum implementation

Build Status, (*1)

Documentation

construct

$type = new Type(Type::BASIC);
$type = Type::createFromConstantName('BASIC');
$type = Type::BASIC();

new Type(5); // InvalidArgumentException

instance methods

$type->getValue(); // 1
$type->getName(); // BASIC
$type->isEqual($type); // true
$type->isEqual(Type::Basic); // true

static methods

Type::getValues(); // [1, 2]
Type::getNames(); // [1 => 'BASIC', 2 => 'COMPLEX']
Type::getNames([2]); // [2 => 'COMPLEX']

Type::isValidValue(1); // true
Type::isValidValue(3); // false

handle null value

$nullType = new Type(null);

$nullType->getName(); // null
$nullType->getValue(); // null

The Versions

17/05 2015

dev-master

9999999-dev

PHP Enum implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

17/05 2015

1.1.1

1.1.1.0

PHP Enum implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

17/11 2014

1.1.0

1.1.0.0

PHP Enum implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

14/11 2014

1.0.0

1.0.0.0

PHP Enum implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires