SelectNode::getFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Xiag\Rql\Parser\Node;
3
4
use Xiag\Rql\Parser\AbstractNode;
5
6
/**
7
 * @codeCoverageIgnore
8
 */
9
class SelectNode extends AbstractNode
10
{
11
    /**
12
     * @var array
13
     */
14
    protected $fields;
15
16
    /**
17
     * @param array $fields
18
     */
19
    public function __construct(array $fields = [])
20
    {
21
        $this->fields = $fields;
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function getNodeName()
28
    {
29
        return 'select';
30
    }
31
32
    /**
33
     * @param string $field
34
     * @param int|null $direction
35
     * @return void
36
     */
37
    public function addField($field, $direction = null)
38
    {
39
        $this->fields[$field] = $direction;
40
    }
41
42
    /**
43
     * @return array
44
     */
45
    public function getFields()
46
    {
47
        return $this->fields;
48
    }
49
}
50