public static function cast($value)
    {
        $currentClass = get_called_class();
        if (!is_object($value) || get_class($value) !== $currentClass) {
            $value = new $currentClass($value);
        }
        return $value;
    }
public static function cast($value)
    {
        $currentClass = get_called_class();
        if (!is_object($value) || get_class($value) !== $currentClass) {
            $value = new $currentClass($value);
        }
        return $value;
    }
public static function cast ( $ value ) { $ currentClass = get_called_class ( ) ; if ( ! is_object ( $ value ) || get_class ( $ value ) !== $ currentClass ) { $ value = new $ currentClass ( $ value ) ; } return $ value ; }
Cast value to enumeration type

@param mixed $value Value that has to be casted
@return static
Cast value to enumeration type