Node   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 20
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setParent() 0 3 1
A getRoot() 0 3 2
A getParent() 0 3 1
1
<?php
2
/**
3
 * This file is part of NACL.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright 2019 Nuglif (2018) Inc.
9
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
10
 * @author    Pierrick Charron <[email protected]>
11
 * @author    Charle Demers <[email protected]>
12
 */
13
14
declare(strict_types=1);
15
16
namespace Nuglif\Nacl;
17
18
abstract class Node
19
{
20
    private ?Node $parent = null;
21
22 356
    public function setParent(Node $parent): void
23
    {
24 356
        $this->parent = $parent;
25
    }
26
27 6
    public function getParent(): ?Node
28
    {
29 6
        return $this->parent;
30
    }
31
32 2
    public function getRoot(): Node
33
    {
34 2
        return $this->parent ? $this->parent->getRoot() : $this;
35
    }
36
37
    abstract public function getNativeValue(): mixed;
38
}
39