Completed
Push — master ( 2cf8eb...09dcac )
by Дмитрий
04:07
created

Block::getChildren()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace PHPSA\ControlFlow;
7
8
use PHPSA\ControlFlow\Node\AbstractNode;
9
10
class Block
11
{
12
    /**
13
     * @var AbstractNode[]
14
     */
15
    protected $children = [];
16
17
    /**
18
     * @var Block[]
19
     */
20
    public $parents = [];
21
22
    /**
23
     * @var Block|null
24
     */
25
    protected $exit;
26
27
    /**
28
     * @var int
29
     */
30
    protected $id;
31
32
    /**
33
     * @var string|null
34
     */
35
    public $label;
36
37
    /**
38
     * @param int $id
39
     */
40 49
    public function __construct($id)
41
    {
42 49
        $this->id = $id;
43 49
    }
44
45
    /**
46
     * @param AbstractNode $node
47
     */
48 46
    public function addChildren(AbstractNode $node)
49
    {
50 46
        $this->children[] = $node;
51 46
    }
52
53
    /**
54
     * @param Block $exit
55
     */
56 9
    public function setExit(Block $exit)
57
    {
58 9
        $this->exit = $exit;
59 9
    }
60
61
    /**
62
     * @return AbstractNode[]
63
     */
64 1
    public function getChildren()
65
    {
66 1
        return $this->children;
67
    }
68
69
    /**
70
     * @return Block|null
71
     */
72
    public function getExit()
73
    {
74
        return $this->exit;
75
    }
76
77
    /**
78
     * @return int
79
     */
80
    public function getId()
81
    {
82
        return $this->id;
83
    }
84
85
    /**
86
     * @param Block
87
     */
88
    public function addParent(Block $parent)
89
    {
90
        $this->parents[] = $parent;
91
    }
92
}
93