Completed
Push — master ( a4273b...a41938 )
by Beniamin
03:04
created

ConjunctionExpression::compile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Phuria\QueryBuilder\Expression;
4
5
/**
6
 * @author Beniamin Jonatan Šimko <[email protected]>
7
 */
8
class ConjunctionExpression implements ExpressionInterface
9
{
10
    const SYMBOL_EQ = '=';
11
    const SYMBOL_GT = '>';
12
    const SYMBOL_GTE = '>=';
13
    const SYMBOL_LT = '<';
14
    const SYMBOL_LTE = '<=';
15
    const SYMBOL_NEQ = '<>';
16
    const SYMBOL_NULL_EQ = '<=>';
17
    const SYMBOL_AND = 'AND';
18
    const SYMBOL_OR = 'OR';
19
20
    /**
21
     * @var ExpressionInterface $left
22
     */
23
    private $left;
24
25
    /**
26
     * @var string $connector
27
     */
28
    private $connector;
29
30
    /**
31
     * @var ExpressionInterface $right
32
     */
33
    private $right;
34
35
    /**
36
     * @param ExpressionInterface $left
37
     * @param string              $connector
38
     * @param ExpressionInterface $right
39
     */
40 1
    public function __construct(ExpressionInterface $left, $connector, ExpressionInterface $right)
41
    {
42 1
        $this->left = $left;
43 1
        $this->connector = $connector;
44 1
        $this->right = $right;
45 1
    }
46
47
    /**
48
     * @inheritdoc
49
     */
50 1
    public function compile()
51
    {
52 1
        return $this->left->compile() . ' ' . $this->connector . ' ' . $this->right->compile();
53
    }
54
}