Conditions | 4 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public static function filter($value) : string |
||
19 | { |
||
20 | if (!is_string($value) || trim($value) === '') { |
||
21 | throw new FilterException('$value must be a non-empty string'); |
||
22 | } |
||
23 | |||
24 | $pattern = '/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/'; |
||
25 | if (preg_match($pattern, $value) === 0) { |
||
26 | throw new FilterException('$value must be in the correct format HH:MM:SS'); |
||
27 | } |
||
28 | |||
29 | return $value; |
||
30 | } |
||
32 |