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