public static function valueOf($value): self
    {
        $strVal = null;

        switch (gettype($value)) {
            case 'object':
                if ($value instanceof StdObject || (\is_object($value) && method_exists($value, '__toString'))) {
                    $strVal = (string) $value;
                }
                break;
            case 'boolean':
                $strVal = $value ? 'true' : 'false';
                break;
            case 'double':
            case 'integer':
            case 'string':
                $strVal = (string) $value;
                break;
        }

        if ($strVal === null) {
            throw new InvalidArgumentException('Unsupported value type!');
        }

        return new static($strVal);
    }
public static function valueOf($value): self
    {
        $strVal = null;

        switch (gettype($value)) {
            case 'object':
                if ($value instanceof StdObject || (\is_object($value) && method_exists($value, '__toString'))) {
                    $strVal = (string) $value;
                }
                break;
            case 'boolean':
                $strVal = $value ? 'true' : 'false';
                break;
            case 'double':
            case 'integer':
            case 'string':
                $strVal = (string) $value;
                break;
        }

        if ($strVal === null) {
            throw new InvalidArgumentException('Unsupported value type!');
        }

        return new static($strVal);
    }
public static function valueOf ( $ value ) : self { $ strVal = null ; switch ( gettype ( $ value ) ) { case 'object' : if ( $ value instanceof StdObject || ( \ is_object ( $ value ) && method_exists ( $ value , '__toString' ) ) ) { $ strVal = ( string ) $ value ; } break ; case 'boolean' : $ strVal = $ value ? 'true' : 'false' ; break ; case 'double' : case 'integer' : case 'string' : $ strVal = ( string ) $ value ; break ; } if ( $ strVal === null ) { throw new InvalidArgumentException ( 'Unsupported value type!' ) ; } return new static ( $ strVal ) ; }
Returns the string representation of the given value

@param mixed $value
@return static
@throws InvalidArgumentException
Returns the string representation of the given value