forked from LiveCarta/PayPal-PHP-SDK
Enabled EC Parameters support
- Updated Api to enabled EC Parameters - Updated Tests - Updated Logging Manager - Added a feature to do validation on accessors.
This commit is contained in:
26
lib/PayPal/Validation/UrlValidator.php
Normal file
26
lib/PayPal/Validation/UrlValidator.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user