Completed
Branch feature/pre-split (4c50c1)
by Anton
03:17
created

RootNode::__construct()   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 2
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
     * {@inheritdoc}
44
     */
45
    protected function registerData(array &$data)
46
    {
47
        $this->result[] = &$data;
48
    }
49
}