We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 5 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | final class DateTime extends AbstractRule |
||
| 27 | { |
||
| 28 | use DateTimeHelper; |
||
| 29 | |||
| 30 | private const EXCEPTIONAL_FORMATS = [ |
||
| 31 | 'c' => 'Y-m-d\TH:i:sP', |
||
| 32 | 'r' => 'D, d M Y H:i:s O', |
||
| 33 | ]; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var string|null |
||
| 37 | */ |
||
| 38 | private $format; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Initializes the rule. |
||
| 42 | * |
||
| 43 | * @param string|null $format |
||
| 44 | */ |
||
| 45 | 3 | public function __construct(string $format = null) |
|
| 46 | { |
||
| 47 | 3 | $this->format = self::EXCEPTIONAL_FORMATS[$format] ?? $format; |
|
| 48 | 3 | } |
|
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | 29 | public function validate($input): bool |
|
| 68 | } |
||
| 69 | } |
||
| 70 |