GraphQL\Examples\Blog\Type\Scalar\UrlType::parseValue PHP Method

parseValue() public method

Parses an externally provided value (query variable) to use as an input
public parseValue ( mixed $value ) : mixed
$value mixed
return mixed
    public function parseValue($value)
    {
        if (!is_string($value) || !filter_var($value, FILTER_VALIDATE_URL)) {
            // quite naive, but after all this is example
            throw new \UnexpectedValueException("Cannot represent value as URL: " . Utils::printSafe($value));
        }
        return $value;
    }