Completed
Push — master ( 65906b...52eeac )
by Beniamin
03:30
created

AbstractOperatorExpression::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Phuria\QueryBuilder\Expression;
4
5
/**
6
 * @author Beniamin Jonatan Šimko <[email protected]>
7
 */
8
abstract class AbstractOperatorExpression implements ExpressionInterface
9
{
10
    /**
11
     * @var ExpressionInterface $leftComponent
12
     */
13
    private $leftComponent;
14
15
    /**
16
     * @var ExpressionInterface $rightComponent
17
     */
18
    private $rightComponent;
19
20
    /**
21
     * @param ExpressionInterface $left
22
     * @param ExpressionInterface $right
23
     */
24
    public function __construct(ExpressionInterface $left, ExpressionInterface $right)
25
    {
26
        $this->leftComponent = $left;
27
        $this->rightComponent = $right;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    abstract public function getOperator();
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function compile()
39
    {
40
        return $this->leftComponent->compile() . ' ' . $this->getOperator() . ' ' . $this->rightComponent->compile();
41
    }
42
}