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