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;
    }
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;
    }
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 ; }
Validates if the value is none-empty and a valid URL.

@param string $url

@throws \InvalidArgumentException

@return string
Validates if the value is none - empty and a valid URL .