| 12345678910111213141516171819202122232425262728293031 |
- <?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 blockchain\web3\src\Validators;
- use blockchain\web3\src\Validators\IValidator;
- class AddressValidator
- {
- /**
- * 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]{40}$/', $value) >= 1);
- }
- }
|