Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
TreenodeDto | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getNodeId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getParentId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTreeId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getIndex | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | /** |
4 | * @author: Doug Wilbourne (dougwilbourne@gmail.com) |
5 | */ |
6 | |
7 | declare(strict_types=1); |
8 | |
9 | namespace pvc\struct\tree\dto; |
10 | |
11 | use pvc\interfaces\struct\tree\dto\TreenodeDtoInterface; |
12 | |
13 | readonly class TreenodeDto implements TreenodeDtoInterface |
14 | { |
15 | public function __construct( |
16 | /** |
17 | * @var non-negative-int |
18 | */ |
19 | public int $nodeId, |
20 | |
21 | /** |
22 | * @var non-negative-int|null |
23 | */ |
24 | public ?int $parentId, |
25 | |
26 | /** |
27 | * @var non-negative-int |
28 | * dto is allowed to have a null treeId. The node hydration method takes two arguments: the first is this dto |
29 | * and the second is the containing tree (because the node keeps a reference to its containing tree). If this |
30 | * dto has a non-null treeid, then the treeid value of this dto is compared to the treeid of the containing |
31 | * tree to ensure they are the same. But if this dto's treeid is null, the node hydration method will use the |
32 | * treeid from the containing tree. |
33 | */ |
34 | public ?int $treeId, |
35 | ) { |
36 | } |
37 | |
38 | public function getNodeId(): int |
39 | { |
40 | return $this->nodeId; |
41 | } |
42 | |
43 | public function getParentId(): ?int |
44 | { |
45 | return $this->parentId ?? null; |
46 | } |
47 | |
48 | public function getTreeId(): ?int |
49 | { |
50 | return $this->treeId ?? null; |
51 | } |
52 | |
53 | public function getIndex(): ?int |
54 | { |
55 | return null; |
56 | } |
57 | } |