This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/lib/PayPal/Validation/NumericValidator.php
japatel d11533110b Sanitize Input for Price Variables
- Updated the model to automatically format the price
- Updated the samples to reflect the new changes
- More Unit Tests
2014-11-03 16:31:03 -06:00

29 lines
587 B
PHP

<?php
namespace PayPal\Validation;
/**
* Class NumericValidator
*
* @package PayPal\Validation
*/
class NumericValidator
{
/**
* Helper method for validating an argument if it is numeric
*
* @param mixed $argument
* @param string|null $argumentName
* @return bool
*/
public static function validate($argument, $argumentName = null)
{
if (trim($argument) != null && !is_numeric($argument)) {
throw new \InvalidArgumentException("$argumentName is not a valid numeric value");
}
return true;
}
}