Gush\Adapter\DefaultConfigurator::validateUrl PHP Method

validateUrl() public method

Validates if the value is none-empty and a valid URL.
public validateUrl ( string $url ) : string
$url string
return string
    public function validateUrl($url)
    {
        if (empty($url)) {
            throw new \InvalidArgumentException('The field cannot be empty.');
        }
        if (!filter_var($url, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException('The field requires a valid URL.');
        }
        return $url;
    }