final public static function byName(string $name)
    {
        if (isset(self::$instances[static::class][$name])) {
            return self::$instances[static::class][$name];
        }

        $const = static::class . "::{$name}";
        if (!\defined($const)) {
            throw new InvalidArgumentException("{$const} not defined");
        }

        return self::$instances[static::class][$name] = new static(\constant($const));
    }
final public static function byName(string $name)
    {
        if (isset(self::$instances[static::class][$name])) {
            return self::$instances[static::class][$name];
        }

        $const = static::class . "::{$name}";
        if (!\defined($const)) {
            throw new InvalidArgumentException("{$const} not defined");
        }

        return self::$instances[static::class][$name] = new static(\constant($const));
    }
final public static function byName ( string $ name ) { if ( isset ( self :: $ instances [ static :: class ] [ $ name ] ) ) { return self :: $ instances [ static :: class ] [ $ name ] ; } $ const = static :: class . "::{$name}" ; if ( ! \ defined ( $ const ) ) { throw new InvalidArgumentException ( "{$const} not defined" ) ; } return self :: $ instances [ static :: class ] [ $ name ] = new static ( \ constant ( $ const ) ) ; }
Get an enumerator instance by the given name

@param string $name The name of the enumerator
@return static
@throws InvalidArgumentException On an invalid or unknown name
@throws LogicException           On ambiguous values
Get an enumerator instance by the given name