Total Complexity | 5 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | trait TParent |
||
18 | { |
||
19 | /** @var IHtmlElement|null */ |
||
20 | protected $parent; |
||
21 | |||
22 | /** |
||
23 | * Set parent element |
||
24 | * @param IHtmlElement|null $parent |
||
25 | */ |
||
26 | 3 | public function setParent(?IHtmlElement $parent = null): void |
|
27 | { |
||
28 | 3 | $this->parent = $parent; |
|
29 | 3 | $this->afterParentSet(); |
|
30 | 3 | } |
|
31 | |||
32 | /** |
||
33 | * Returns parent element |
||
34 | * @return IHtmlElement|null |
||
35 | */ |
||
36 | 1 | public function getParent(): ?IHtmlElement |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * Change element settings after new parent has been set |
||
43 | */ |
||
44 | 3 | protected function afterParentSet(): void |
|
45 | { |
||
46 | 3 | } |
|
47 | |||
48 | /** |
||
49 | * Add $element after current one - if there is any parent |
||
50 | * @param IHtmlElement|string $element |
||
51 | * @param string $alias |
||
52 | */ |
||
53 | 1 | public function append($element, ?string $alias = null): void |
|
57 | } |
||
58 | 1 | } |
|
59 | } |
||
60 |