for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Oqq\Minc\Common;
/**
* @author Eric Braun <[email protected]>
*/
abstract class Enum
{
/** @var array */
protected static $cache;
* @param string|int $value
*
* @return bool
public static function isValid($value)
return in_array($value, static::getValues(), true);
}
* @return array
public static function getValues()
if (!isset(static::$cache[static::class])) {
$reflection = new \ReflectionClass(static::class);
static::$cache[static::class] = $reflection->getConstants();
return static::$cache[static::class];