Total Complexity | 4 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | final class TimeOfDayFilter |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | const NON_EMPTY_STRING_ERROR = 'Value must be a non-empty string'; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | const INCORRECT_FORMAT_ERROR = 'Value must be in the format HH:MM:SS'; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | const TIME_OF_DAY_REGEX = '/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/'; |
||
23 | |||
24 | /** |
||
25 | * Filters a given value as a valid HH:MM:SS formatted string. |
||
26 | * |
||
27 | * @param mixed $value the value to be filtered. |
||
28 | * |
||
29 | * @return string |
||
30 | * |
||
31 | * @throws FilterException Thrown if the value cannot be filtered. |
||
32 | */ |
||
33 | public static function filter($value) : string |
||
46 |