Total Complexity | 4 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | final class Series extends ChainableFormatter |
||
11 | { |
||
12 | /** |
||
13 | * @var WordFormatter[] Word formatters. |
||
14 | */ |
||
15 | private $wordFormatters; |
||
16 | |||
17 | /** |
||
18 | * @param WordFormatter ...$wordFormatters Word formatters. |
||
19 | */ |
||
20 | 3 | public function __construct(WordFormatter ...$wordFormatters) |
|
23 | 3 | } |
|
24 | |||
25 | /** |
||
26 | * {@inheritDoc} |
||
27 | */ |
||
28 | 5 | protected function applyCurrent(iterable $words): Traversable |
|
29 | { |
||
30 | 5 | yield from $this->formatWord($words, $this->wordFormatters); |
|
31 | 5 | } |
|
32 | |||
33 | /** |
||
34 | * @param iterable<string> $words Words to format. |
||
35 | * @param WordFormatter[] $wordFormatters Word formatters. |
||
36 | * @return Traversable<string> Formatted words. May contain duplicates. |
||
37 | */ |
||
38 | 5 | private function formatWord(iterable $words, array $wordFormatters): Traversable |
|
47 | 5 | } |
|
48 | } |
||
49 |