Identity validator.
This commit is contained in:
parent
2d394c825c
commit
5d54bc29c3
31
src/Validators/IdentityValidator.php
Normal file
31
src/Validators/IdentityValidator.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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 IdentityValidator
|
||||
{
|
||||
/**
|
||||
* 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]+$/', $value) >= 1);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user