| Total Complexity | 6 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | class Node implements NodeInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var ItemInterface |
||
| 13 | */ |
||
| 14 | private $item; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var NodeInterface|null |
||
| 18 | */ |
||
| 19 | private $left; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var NodeInterface|null |
||
| 23 | */ |
||
| 24 | private $right; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Node constructor. |
||
| 28 | * @param ItemInterface $item |
||
| 29 | */ |
||
| 30 | 96 | public function __construct(ItemInterface $item) |
|
| 31 | { |
||
| 32 | 96 | $this->item = $item; |
|
| 33 | 96 | $this->left = null; |
|
| 34 | 96 | $this->right = null; |
|
| 35 | 96 | } |
|
| 36 | |||
| 37 | /** |
||
| 38 | * @return ItemInterface get item from the node |
||
| 39 | */ |
||
| 40 | 72 | public function getItem() : ItemInterface |
|
| 41 | { |
||
| 42 | 72 | return $this->item; |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param NodeInterface $node set right node |
||
| 47 | */ |
||
| 48 | 75 | public function setRight(NodeInterface $node): void |
|
| 49 | { |
||
| 50 | 75 | $this->right = $node; |
|
| 51 | 75 | } |
|
| 52 | |||
| 53 | /** |
||
| 54 | * @param NodeInterface $node set left node |
||
| 55 | */ |
||
| 56 | 78 | public function setLeft(NodeInterface $node): void |
|
| 57 | { |
||
| 58 | 78 | $this->left = $node; |
|
| 59 | 78 | } |
|
| 60 | |||
| 61 | /** |
||
| 62 | * @return NodeInterface|null get right node |
||
| 63 | */ |
||
| 64 | 69 | public function getRight(): ?NodeInterface |
|
| 65 | { |
||
| 66 | 69 | return $this->right; |
|
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @return NodeInterface|null get left node |
||
| 71 | */ |
||
| 72 | 69 | public function getLeft(): ?NodeInterface |
|
| 75 | } |
||
| 76 | } |
||
| 77 |