jayzeng/php-enum

PHP enum class that OO way to manipulate enums

0.2 2013-03-02 06:03 UTC

This package is not auto-updated.

Last update: 2024-12-15 04:34:25 UTC


README

Latest Stable Version Total DownloadsBuild Status

Project website: (http://jayzeng.github.com/PHPEnum/)

##Usage:

class StubUtilEnum extends Enum
{
    const ONE   = 1;
    const TWO   = 2;
    const THREE = 3;
    const FOUR  = "four";
}


// Retrieve value mapped to the label
$StubUtilEnum->getValue('ONE');   // returns 1
$StubUtilEnum->getValue('FOUR');   // returns four
$StubUtilEnum->getValues();    //  array

// Determine if a label exists
$StubUtilEnum->hasLabel(1);         // true
$StubUtilEnum->hasLabel('oops');    // false

##Details See https://github.com/jayzeng/PHPEnum/blob/master/Tests/Src/EnumTest.php

##Issues & Development

##How to release new version?

  • RELEASE_VERSION - version number
  • RELEASE_MESSAGE - release message
make release RELEASE_VERSION="0.1" RELEASE_MESSAGE="v0.1 is released"

##Author: Jay Zeng, e-mail: jayzeng@jay-zeng.com