helpers/BaseEnum.php
public static function createByValue($value)
    {
        $constants = self::getConstantsByValue();

        if (!array_key_exists($value, $constants)) {
            throw EnumException::invalidValue(get_called_class(), $value);
        }

        return new static ($value);
    }
public static function createByValue($value)
    {
        $constants = self::getConstantsByValue();

        if (!array_key_exists($value, $constants)) {
            throw EnumException::invalidValue(get_called_class(), $value);
        }

        return new static ($value);
    }
public static function createByValue ( $ value ) { $ constants = self :: getConstantsByValue ( ) ; if ( ! array_key_exists ( $ value , $ constants ) ) { throw EnumException :: invalidValue ( get_called_class ( ) , $ value ) ; } return new static ( $ value ) ; }
Creates a new type instance using the value

@param mixed $value The value

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