helpers/BaseEnum.php
public static function createByName($name)
    {
        $constants = self::getConstantsByName();

        if (!array_key_exists($name, $constants)) {
            throw EnumException::invalidName(get_called_class(), $name);
        }

        return new static($constants[$name]);
    }
public static function createByName($name)
    {
        $constants = self::getConstantsByName();

        if (!array_key_exists($name, $constants)) {
            throw EnumException::invalidName(get_called_class(), $name);
        }

        return new static($constants[$name]);
    }
public static function createByName ( $ name ) { $ constants = self :: getConstantsByName ( ) ; if ( ! array_key_exists ( $ name , $ constants ) ) { throw EnumException :: invalidName ( get_called_class ( ) , $ name ) ; } return new static ( $ constants [ $ name ] ) ; }
Creates a new type instance using the name of a value

@param string $name The name of a value

@return $this The new type instance
@throws EnumException If the name is invalid
Creates a new type instance using the name of a value