We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | final class Time extends AbstractRule |
||
| 28 | { |
||
| 29 | /** |
||
| 30 | * @var string |
||
| 31 | */ |
||
| 32 | private $format; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Initializes the rule. |
||
| 36 | * |
||
| 37 | * @param string $format |
||
| 38 | * |
||
| 39 | * @throws ComponentException |
||
| 40 | */ |
||
| 41 | 3 | public function __construct(string $format = 'H:i:s') |
|
| 42 | { |
||
| 43 | 3 | if (!preg_match('/^[gGhHisuvaA\W]+$/', $format)) { |
|
| 44 | 2 | throw new ComponentException(sprintf('"%s" is not a valid date format', $format)); |
|
| 45 | } |
||
| 46 | |||
| 47 | 1 | $this->format = $format; |
|
| 48 | 1 | } |
|
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | 14 | public function validate($input): bool |
|
| 62 | } |
||
| 63 | } |
||
| 64 |