Completed
Branch feature/pre-split (669609)
by Anton
03:30
created

RootNode::__destruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * components
4
 *
5
 * @author    Wolfy-J
6
 */
7
namespace Spiral\ORM\Entities\Nodes;
8
9
use Spiral\ORM\Entities\Nodes\Traits\DuplicateTrait;
10
11
class RootNode extends AbstractNode
12
{
13
    use DuplicateTrait;
14
15
    /**
16
     * Array used to aggregate all nested node results in a form of tree.
17
     *
18
     * @var array
19
     */
20
    private $result = [];
21
22
    /**
23
     * @param array $columns
24
     * @param array $primaryKeys
25
     */
26
    public function __construct(array $columns = [], array $primaryKeys = [])
27
    {
28
        parent::__construct($columns, null);
29
        $this->duplicateCriteria = $primaryKeys;
30
    }
31
32
    /**
33
     * Get resulted tree.
34
     *
35
     * @return array
36
     */
37
    public function getResult(): array
38
    {
39
        return $this->result;
40
    }
41
42
    /**
43
     * Destructing.
44
     */
45
    public function __destruct()
46
    {
47
        $this->result = [];
48
        parent::__destruct();
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    protected function pushData(array &$data)
55
    {
56
        $this->result[] = &$data;
57
    }
58
}