Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| AbstractRadix | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| verify | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @license MIT |
| 5 | * @author hazuki3417<hazuki3417@gmail.com> |
| 6 | * @copyright 2021 hazuki3417 all rights reserved. |
| 7 | */ |
| 8 | |
| 9 | namespace Selen\Verify\Str\Radixes; |
| 10 | |
| 11 | abstract class AbstractRadix implements RadixInterface |
| 12 | { |
| 13 | public const CARDINALITY = 0; |
| 14 | public const NUMBER_RANGE = ''; |
| 15 | public const ALPHABET_RANGE = ''; |
| 16 | |
| 17 | /** |
| 18 | * {@inheritdoc} |
| 19 | */ |
| 20 | public static function verify(string $val): bool |
| 21 | { |
| 22 | return \preg_match( |
| 23 | '/^[' . static::NUMBER_RANGE . static::ALPHABET_RANGE . ']+$/i', |
| 24 | $val |
| 25 | ); |
| 26 | } |
| 27 | } |