Completed
Pull Request — master (#293)
by Дмитрий
02:40
created

Block::addChildren()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
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 $childrens = [];
16
17
    /**
18
     * @var Block|null
19
     */
20
    protected $exit;
21
22
    /**
23
     * @var int
24
     */
25
    protected $id;
26
27
    /**
28
     * @param int $id
29
     */
30
    public function __construct($id)
31
    {
32
        $this->id = $id;
33
    }
34
35
    /**
36
     * @param AbstractNode $node
37
     */
38
    public function addChildren(AbstractNode $node)
39
    {
40
        $this->childrens[] = $node;
41
    }
42
43
    /**
44
     * @param Block $exit
45
     */
46
    public function setExit(Block $exit)
47
    {
48
        $this->exit = $exit;
49
    }
50
51
    /**
52
     * @return AbstractNode[]
53
     */
54
    public function getChildrens()
55
    {
56
        return $this->childrens;
57
    }
58
59
    /**
60
     * @return Block|null
61
     */
62
    public function getExit()
63
    {
64
        return $this->exit;
65
    }
66
67
    /**
68
     * @return int
69
     */
70
    public function getId()
71
    {
72
        return $this->id;
73
    }
74
}
75