Conditions | 3 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function match($value, $pattern) |
||
16 | { |
||
17 | if (!is_string($value)) { |
||
18 | $this->error = sprintf( |
||
19 | "%s \"%s\" is not a valid UUID: not a string.", |
||
20 | gettype($value), |
||
21 | new StringConverter($value) |
||
22 | ); |
||
23 | return false; |
||
24 | } |
||
25 | |||
26 | if (1 !== preg_match(self::UUID_FORMAT_PATTERN, $value)) { |
||
27 | $this->error = sprintf( |
||
28 | "%s \"%s\" is not a valid UUID: invalid format.", |
||
29 | gettype($value), |
||
30 | $value |
||
31 | ); |
||
32 | return false; |
||
33 | } |
||
34 | |||
35 | return true; |
||
36 | } |
||
37 | |||
46 |