Passed
Push — master ( 66d9a1...cecd70 )
by noitran
03:34
created

AbstractExpr::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
namespace Noitran\Repositories\RQL\Expressions;
4
5
use Noitran\Repositories\Contracts\Expression\ExprInterface;
6
7
/**
8
 * Class AbstractExpr
9
 */
10
abstract class AbstractExpr implements ExprInterface
11
{
12
    /**
13
     * @var string|null
14
     */
15
    protected $relation;
16
17
    /**
18
     * @var string
19
     */
20
    protected $column;
21
22
    /**
23
     * @var mixed
24
     */
25
    protected $value;
26
27
    /**
28
     * @var string
29
     */
30
    protected $expression;
31
32
    /**
33
     * @var string
34
     */
35
    protected $operator;
36
37
    /**
38
     * AbstractExpr constructor.
39
     *
40
     * @param string|null $relation
41
     * @param string $column
42
     * @param mixed $value
43
     */
44
    public function __construct(?string $relation, string $column, $value)
45
    {
46
        $this->relation = $relation;
47
        $this->column = $column;
48
        $this->value = $value;
49
    }
50
51
    /**
52
     * @param string|null $expression
53
     *
54
     * @return AbstractExpr
55
     */
56
    public function setExpression(string $expression = null): self
57
    {
58
        $this->expression = $expression;
59
60
        return $this;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getExpression(): string
67
    {
68
        return $this->expression;
69
    }
70
71
    /**
72
     * @param string|null $operator
73
     *
74
     * @return AbstractExpr
75
     */
76
    public function setOperator(string $operator = null): self
77
    {
78
        $this->operator = $operator;
79
80
        return $this;
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getOperator(): string
87
    {
88
        return $this->operator;
89
    }
90
}
91