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

RootNode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getResult() 0 4 1
A registerData() 0 4 1
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
}