mirror of
https://github.com/Karaka-Management/Resources.git
synced 2026-01-11 13:28:40 +00:00
27 lines
569 B
PHP
27 lines
569 B
PHP
<?php
|
|
|
|
namespace PayPal\Validation;
|
|
|
|
/**
|
|
* Class UrlValidator
|
|
*
|
|
* @package PayPal\Validation
|
|
*/
|
|
class UrlValidator
|
|
{
|
|
|
|
/**
|
|
* Helper method for validating URLs that will be used by this API in any requests.
|
|
*
|
|
* @param $url
|
|
* @param string|null $urlName
|
|
* @throws \InvalidArgumentException
|
|
*/
|
|
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");
|
|
}
|
|
}
|
|
}
|