AbstractExpr::getValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Noitran\RQL\Expressions;
6
7
use Noitran\RQL\Contracts\Expression\ExprInterface;
8
9
/**
10
 * Class AbstractExpr.
11
 */
12
abstract class AbstractExpr implements ExprInterface
13
{
14
    /**
15
     * @var string|null
16
     */
17
    protected $relation;
18
19
    /**
20
     * @var string
21
     */
22
    protected $column;
23
24
    /**
25
     * @var mixed
26
     */
27
    protected $value;
28
29
    /**
30
     * @var string
31
     */
32
    protected $expression;
33
34
    /**
35
     * @var string
36
     */
37
    protected $operator;
38
39
    /**
40
     * AbstractExpr constructor.
41
     *
42
     * @param string|null $relation
43
     * @param string $column
44
     * @param mixed $value
45
     */
46 12
    public function __construct(?string $relation, string $column, $value)
47
    {
48 12
        $this->relation = $relation;
49 12
        $this->column = $column;
50 12
        $this->value = $value;
51 12
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getRelation(): ?string
57
    {
58
        return $this->relation;
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64 12
    public function getColumn(): string
65
    {
66 12
        return $this->column;
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72 12
    public function getValue()
73
    {
74 12
        return $this->value;
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80 12
    public function setExpression(string $expression = null): self
81
    {
82 12
        $this->expression = $expression;
83
84 12
        return $this;
85
    }
86
87
    /**
88
     * {@inheritdoc}
89
     */
90 12
    public function getExpression(): string
91
    {
92 12
        return $this->expression;
93
    }
94
95
    /**
96
     * {@inheritdoc}
97
     */
98 12
    public function setOperator(string $operator = null): self
99
    {
100 12
        $this->operator = $operator;
101
102 12
        return $this;
103
    }
104
105
    /**
106
     * {@inheritdoc}
107
     */
108 7
    public function getOperator(): ?string
109
    {
110 7
        return $this->operator;
111
    }
112
113
    /**
114
     * @param $delimiter
115
     * @param $value
116
     *
117
     * @return array
118
     */
119 5
    protected function valueToArray($delimiter, $value): array
120
    {
121 5
        return explode($delimiter, $value);
122
    }
123
}
124