Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | trait Chaining |
||
12 | { |
||
13 | /** |
||
14 | * @var Formatter|null Next character tree formatter in the chain. |
||
15 | */ |
||
16 | private $next = null; |
||
17 | |||
18 | /** |
||
19 | * @param Formatter|null $next Formatter to apply after this date formatter. |
||
20 | */ |
||
21 | 2 | public function setNext(?Formatter $next): void |
|
22 | { |
||
23 | 2 | $this->next = $next; |
|
24 | 2 | } |
|
25 | |||
26 | /** |
||
27 | * @return Formatter|null Next formatter in the chain. |
||
28 | */ |
||
29 | 2 | public function getNext(): ?Formatter |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param iterable<DateTimeInterface> $dates Dates to format. |
||
36 | * @return CharTree The dates formatted by the formatter chain. |
||
37 | */ |
||
38 | 5 | public function apply(iterable $dates): CharTree |
|
44 | } |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param iterable<DateTimeInterface> $dates Dates to format. |
||
49 | * @return CharTree The dates formatted by this date formatter. |
||
50 | */ |
||
51 | abstract protected function applyCurrent(iterable $dates): CharTree; |
||
52 | } |
||
53 |