static function ByValue($value)
    {
        $calledClass = get_called_class();
        $allowed = self::AllowedClassValues($calledClass);
        if (!in_array($value, $allowed, true))
            throw new \InvalidArgumentException('Value ' . $value . ' not allowed for enum ' . $calledClass);
        
        return new $calledClass($value);
    }
static function ByValue($value)
    {
        $calledClass = get_called_class();
        $allowed = self::AllowedClassValues($calledClass);
        if (!in_array($value, $allowed, true))
            throw new \InvalidArgumentException('Value ' . $value . ' not allowed for enum ' . $calledClass);
        
        return new $calledClass($value);
    }
static function ByValue ( $ value ) { $ calledClass = get_called_class ( ) ; $ allowed = self :: AllowedClassValues ( $ calledClass ) ; if ( ! in_array ( $ value , $ allowed , true ) ) throw new \ InvalidArgumentException ( 'Value ' . $ value . ' not allowed for enum ' . $ calledClass ) ; return new $ calledClass ( $ value ) ; }
Creates the enum by value
@param string $value
@return Enum
@throws \InvalidArgumentException
Creates the enum by value