Total Complexity | 6 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
11 | final class Series implements WordFormatter |
||
12 | { |
||
13 | /** |
||
14 | * @var WordFormatter[] Word formatters. |
||
15 | */ |
||
16 | private $wordFormatters; |
||
17 | |||
18 | /** |
||
19 | * @param WordFormatter ...$wordFormatters Word formatters. |
||
20 | */ |
||
21 | 3 | public function __construct(WordFormatter ...$wordFormatters) |
|
22 | { |
||
23 | 3 | if ($wordFormatters === []) { |
|
24 | 1 | throw new InvalidArgumentException('At least one word formatter must be specified.'); |
|
25 | } |
||
26 | |||
27 | 2 | $this->wordFormatters = $wordFormatters; |
|
28 | 2 | } |
|
29 | |||
30 | /** |
||
31 | * {@inheritDoc} |
||
32 | */ |
||
33 | 2 | public function apply(string $word): Traversable |
|
36 | 2 | } |
|
37 | |||
38 | 2 | private function formatWord(string $word, array $wordFormatters): Traversable |
|
52 |