Total Complexity | 2 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
5 | class AbstractUuidCase |
||
6 | { |
||
7 | /** |
||
8 | * Does the value match the canonical UUID format? |
||
9 | * |
||
10 | * @param string $value The value to be checked. |
||
11 | * |
||
12 | * @return bool |
||
13 | */ |
||
14 | 63 | protected function isCanonical($value) |
|
15 | { |
||
16 | 63 | $regex = '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i'; |
|
17 | |||
18 | 63 | return (bool) preg_match($regex, $value); |
|
19 | } |
||
20 | |||
21 | /** |
||
22 | * Is the value a hex-only UUID? |
||
23 | * |
||
24 | * @param string $value The value to be checked. |
||
25 | * |
||
26 | * @return bool |
||
27 | */ |
||
28 | 87 | protected function isHexOnly($value) |
|
33 | } |
||
34 | } |
||
35 |