2017 © Pedro Peláez
 

library enum

Enum type for PHP

image

phpextra/enum

Enum type for PHP

  • Thursday, September 3, 2015
  • by jkobus
  • Repository
  • 1 Watchers
  • 2 Stars
  • 12,312 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

Enum type

Latest Stable Version Total Downloads License Build Status Scrutinizer Code Quality Code Coverage GitTip, (*1)

Usage

Enum (PHPExtra\Type\EnumInterface)

Create your first enum type by creating a new class:, (*2)

class TheGuy extends Enum
{
    const _default = self::NICE_GUY;
    const SMART_GUY = 'Mike';
    const NICE_GUY = 'Rick';
}

Thats all., (*3)

Now you can use it:, (*4)

$guy = new TheGuy();
echo $guy->getValue(); // returns Rick

$mike = new TheGuy(TheGuy::MIKE);
echo $mike->getValue(); // returns Mike

echo $guy->isEqual($mike); // returns false

If no default value will be specified, you must set it as a constructor argument. If given constructor value will be invalid, \UnexpectedValueException will be thrown., (*5)

Installation (Composer)

{
    "require": {
        "phpextra/enum":"~1.0"
    }
}

Changelog

No releases yet

Contributing

All code contributions must go through a pull request. Fork the project, create a feature branch, and send me a pull request. To ensure a consistent code base, you should make sure the code follows the coding standards. If you would like to help take a look at the list of issues., (*6)

Requirements

See composer.json for a full list of dependencies.

Authors

Jacek Kobus - <kobus.jacek@gmail.com>

License information

See the file LICENSE.txt for copying permission.

The Versions

03/09 2015

2.0.x-dev

2.0.9999999.9999999-dev https://github.com/phpextra/enum

Enum type for PHP

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Jacek Kobus

enum

16/08 2014

dev-master

9999999-dev https://github.com/phpextra/enum

Enum type for PHP

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Jacek Kobus

enum

16/08 2014

1.0.0

1.0.0.0 https://github.com/phpextra/enum

Enum type for PHP

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

by Jacek Kobus

enum