Total Complexity | 8 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
9 | class DeferrableTermFieldPrinter implements TermFieldPrinterInterface |
||
10 | { |
||
11 | protected ?TermFieldPrinterInterface $printer = null; |
||
12 | |||
13 | public function __construct(?TermFieldPrinterInterface $printer = null) |
||
14 | { |
||
15 | $this->printer = $printer; |
||
16 | } |
||
17 | |||
18 | public function print(array $fields, ServerRequestInterface $request): string |
||
19 | { |
||
20 | return $this->printer |
||
21 | ? $this->printer->print($fields, $request) |
||
22 | : $this->printFields($fields, $request); |
||
23 | } |
||
24 | |||
25 | public function printOne(TermFieldInterface $field, ServerRequestInterface $request): string |
||
26 | { |
||
27 | return $this->printer |
||
28 | ? $this->printer->printOne($field, $request) |
||
29 | : $field->renderComponent($request); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param TermFieldInterface[] $fields |
||
34 | */ |
||
35 | protected function printFields(array $fields, ServerRequestInterface $request): string |
||
44 | } |
||
45 | } |
||
46 |