ControlNode   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 13
c 1
b 0
f 0
dl 0
loc 41
ccs 15
cts 15
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setNode() 0 4 1
A addSubNode() 0 4 1
A getControl() 0 3 1
A setControl() 0 4 1
A getSubNodes() 0 3 1
A getNode() 0 3 1
1
<?php
2
3
namespace kalanis\kw_tree_controls;
4
5
6
use kalanis\kw_forms\Controls\AControl;
7
use kalanis\kw_tree\Essentials\FileNode;
8
9
10
/**
11
 * Class ControlNode
12
 * @package kalanis\kw_tree_control
13
 * File in directory (could be directory too)
14
 * Join FileNode and its control
15
 */
16
class ControlNode
17
{
18
    protected ?FileNode $node = null;
19
    protected ?AControl $control = null;
20
    /** @var ControlNode[] */
21
    protected array $subNodes = [];
22
23 6
    public function setNode(?FileNode $node = null): self
24
    {
25 6
        $this->node = $node;
26 6
        return $this;
27
    }
28
29 3
    public function getNode(): ?FileNode
30
    {
31 3
        return $this->node;
32
    }
33
34 6
    public function setControl(?AControl $control = null): self
35
    {
36 6
        $this->control = $control;
37 6
        return $this;
38
    }
39
40 6
    public function getControl(): ?AControl
41
    {
42 6
        return $this->control;
43
    }
44
45 6
    public function addSubNode(ControlNode $node): self
46
    {
47 6
        $this->subNodes[] = $node;
48 6
        return $this;
49
    }
50
51
    /**
52
     * @return ControlNode[]
53
     */
54 6
    public function getSubNodes(): array
55
    {
56 6
        return $this->subNodes;
57
    }
58
}
59