Total Complexity | 5 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class DateTime extends DateTimeWizard |
||
6 | { |
||
7 | /** |
||
8 | * @var string[] |
||
9 | */ |
||
10 | protected array $separators; |
||
11 | |||
12 | /** |
||
13 | * @var array<DateTimeWizard|string> |
||
14 | */ |
||
15 | protected array $formatBlocks; |
||
16 | |||
17 | /** |
||
18 | * @param null|string|string[] $separators |
||
19 | * If you want to use only a single format block, then pass a null as the separator argument |
||
20 | * @param DateTimeWizard|string ...$formatBlocks |
||
21 | */ |
||
22 | 2 | public function __construct($separators, ...$formatBlocks) |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param DateTimeWizard|string $value |
||
33 | */ |
||
34 | 2 | private function mapFormatBlocks($value): string |
|
35 | { |
||
36 | // Any date masking codes are returned as lower case values |
||
37 | 2 | if (is_object($value)) { |
|
38 | // We can't explicitly test for Stringable until PHP >= 8.0 |
||
39 | 2 | return $value; |
|
40 | } |
||
41 | |||
42 | // Wrap any string literals in quotes, so that they're clearly defined as string literals |
||
43 | 2 | return $this->wrapLiteral($value); |
|
44 | } |
||
45 | |||
46 | 2 | public function format(): string |
|
49 | } |
||
50 | } |
||
51 |