src/main/php/lang/Enum.php
public static function forValue($value)
    {
        $enumClass = new \ReflectionClass(get_called_class());
        foreach ($enumClass->getStaticProperties() as $instance) {
            if ($instance->value() === $value) {
                return $instance;
            }
        }

        throw new \InvalidArgumentException(
                'Enum ' . $enumClass->getName() . ' for value ' . $value
                . ' does not exist.'
        );
    }
public static function forValue($value)
    {
        $enumClass = new \ReflectionClass(get_called_class());
        foreach ($enumClass->getStaticProperties() as $instance) {
            if ($instance->value() === $value) {
                return $instance;
            }
        }

        throw new \InvalidArgumentException(
                'Enum ' . $enumClass->getName() . ' for value ' . $value
                . ' does not exist.'
        );
    }
returns the enum instance of given class identified by its value

@api
@param   string  $value
@return  \stubbles\lang\Enum
@throws  \InvalidArgumentException