public static function createByName($name)
    {
        $constants = static::getConstantsByName();

        if (!array_key_exists($name, $constants)) {
            throw new UnexpectedValueException("Name '{$name}' is not exists in the enum constants list " . get_called_class());
        }

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

        if (!array_key_exists($name, $constants)) {
            throw new UnexpectedValueException("Name '{$name}' is not exists in the enum constants list " . get_called_class());
        }

        return new static($constants[$name]);
    }
public static function createByName ( $ name ) { $ constants = static :: getConstantsByName ( ) ; if ( ! array_key_exists ( $ name , $ constants ) ) { throw new UnexpectedValueException ( "Name '{$name}' is not exists in the enum constants list " . get_called_class ( ) ) ; } return new static ( $ constants [ $ name ] ) ; }
Creates a new type instance using the name of a value.

@param string $name The name of a value

@throws UnexpectedValueException

@return $this The new type instance
Creates a new type instance using the name of a value .