web3.php/src/Validators/QuantityValidator.php
2017-12-19 14:55:51 +08:00

29 lines
539 B
PHP

<?php
/**
* This file is part of web3.php package.
*
* (c) Kuan-Cheng,Lai <alk03073135@gmail.com>
*
* @author Peter Lai <alk03073135@gmail.com>
* @license MIT
*/
namespace Web3\Validators;
use Web3\Validators\IValidator;
class QuantityValidator
{
/**
* validate
*
* @param string $value
* @return bool
*/
public static function validate($value)
{
// maybe change in_int and preg_match future
return (is_int($value) || preg_match('/^0x[a-fA-f0-9]+$/', $value) >= 1);
}
}