1 <?php
2
3 namespace PayPal\Validation;
4
5 /**
6 * Class UrlValidator
7 *
8 * @package PayPal\Validation
9 */
10 class UrlValidator
11 {
12
13 /**
14 * Helper method for validating URLs that will be used by this API in any requests.
15 *
16 * @param $url
17 * @param string|null $urlName
18 * @throws \InvalidArgumentException
19 */
20 public static function validate($url, $urlName = null)
21 {
22 if (filter_var($url, FILTER_VALIDATE_URL) === false) {
23 throw new \InvalidArgumentException("$urlName is not a fully qualified URL");
24 }
25 }
26 }
27