PayPal\Validation\UrlValidator::validate PHP Method

validate() public static method

Helper method for validating URLs that will be used by this API in any requests.
public static validate ( $url, string | null $urlName = null )
$url
$urlName string | null
    public static function validate($url, $urlName = null)
    {
        if (filter_var($url, FILTER_VALIDATE_URL) === false) {
            throw new \InvalidArgumentException("{$urlName} is not a fully qualified URL");
        }
    }

Usage Example

Example #1
0
 /**
  * Base URL to web applications endpoint
  * Valid Values: ["https://www.paypal.com/{country_code}/webapps/xocspartaweb/webflow/sparta/proxwebflow", "https://www.paypal.com/{country_code}/proxflow"]
  *
  * @param string $web_url
  * @throws \InvalidArgumentException
  * @return $this
  */
 public function setWebUrl($web_url)
 {
     UrlValidator::validate($web_url, "WebUrl");
     $this->web_url = $web_url;
     return $this;
 }
All Usage Examples Of PayPal\Validation\UrlValidator::validate
UrlValidator