add transaction id validator
This commit is contained in:
parent
fb94ea92c5
commit
e506a0f847
26
src/Validators/TransactionIdValidator.php
Normal file
26
src/Validators/TransactionIdValidator.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Halil Beycan <halilbeycan0@gmail.com>
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Web3\Validators;
|
||||||
|
|
||||||
|
class TransactionIdValidator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* validate
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function validate($value)
|
||||||
|
{
|
||||||
|
if (!is_string($value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (preg_match('/^0x[a-fA-F0-9]{66}$/', $value) >= 1);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user