2017 © Pedro Peláez
 

library constant-resolver

Provides functionality for mapping class constant values back to their semantic names

image

jameshalsall/constant-resolver

Provides functionality for mapping class constant values back to their semantic names

  • Wednesday, July 31, 2013
  • by jaitsu
  • Repository
  • 1 Watchers
  • 4 Stars
  • 307 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

constant-resolver

PHP Class that resolves class constant values back to their semantic names., (*1)

Installation

Composer

Add "jameshalsall/constant-resolver" to your composer.json require section., (*2)

Usage

Example class:, (*3)

```` php <?php, (*4)

class SomeClass { const MY_CONSTANT_NAME = 1;, (*5)

...

}, (*6)


```` php <?php use JamesHalsall\ConstantResolver; $someClass = new SomeClass(); $resolver = new ConstantResolver($someClass); // returns 'SomeClass::MY_CONSTANT_NAME' $constant = $resolver->resolve(1);

Example

```` php <?php, (*7)

$httpErrorCodes = new HttpErrorCodes();, (*8)

$resolver = new ConstantResolver($enumerableClass);, (*9)

// returns 'HttpErrorCodes::NOT_FOUND' $resolver->resolve(404);, (*10)


Same example with array return: ```` php <?php ... $resolver->setReturnType(ConstantResolver::RETURN_ARRAY); /** * returns array( * 'NOT_FOUND' => 'HttpErrorCodes::NOT_FOUND' * ); */

The Versions

31/07 2013

dev-master

9999999-dev http://github.com/jameshalsall/constant-resolver

Provides functionality for mapping class constant values back to their semantic names

  Sources   Download

MIT

The Requires

  • php >=5.3.10

 

constants

31/07 2013

2.0.0

2.0.0.0 http://github.com/jameshalsall/constant-resolver

Provides functionality for mapping class constant values back to their semantic names

  Sources   Download

MIT

The Requires

  • php >=5.3.10

 

constants

04/04 2013

1.0.1

1.0.1.0 http://github.com/jaitsu87/constant-resolver

Provides functionality for mapping class constant values back to their semantic names

  Sources   Download

MIT

The Requires

  • php >=5.3.10

 

constants

28/03 2013

1.0

1.0.0.0 http://github.com/jaitsu87/constant-resolver

Provides functionality for mapping class constant values back to their semantic names

  Sources   Download

MIT

The Requires

  • php >=5.3.10

 

constants