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

ConjunctionExpression   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 47
ccs 7
cts 7
cp 1
rs 10

2 Methods

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