Completed
Push — master ( 175b65...c73746 )
by Alex
18s queued 15s
created

EdmIfExpression::__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 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 5
rs 10
1
<?php
2
3
4
namespace AlgoWeb\ODataMetadata\Library\Expressions;
5
6
7
use AlgoWeb\ODataMetadata\Enums\ExpressionKind;
8
use AlgoWeb\ODataMetadata\Interfaces\Expressions\IExpression;
9
use AlgoWeb\ODataMetadata\Interfaces\Expressions\IIfExpression;
10
use AlgoWeb\ODataMetadata\Library\EdmElement;
11
12
/**
13
 * Represents an EDM if expression.
14
 *
15
 * @package AlgoWeb\ODataMetadata\Library\Expressions
16
 */
17
class EdmIfExpression extends EdmElement implements IIfExpression
18
{
19
    /**
20
     * @var IExpression
21
     */
22
    private $testExpression;
23
    /**
24
     * @var IExpression
25
     */
26
    private $trueExpression;
27
    /**
28
     * @var IExpression
29
     */
30
    private  $falseExpression;
31
32
    /**
33
     * Initializes a new instance of the EdmIfExpression class.
34
     * @param IExpression $testExpression Test expression
35
     * @param IExpression $trueExpression Expression to evaluate if testExpression evaluates to true.
36
     * @param IExpression $falseExpression Expression to evaluate if testExpression evaluates to false.
37
     */
38
    public function __construct(IExpression $testExpression, IExpression $trueExpression, IExpression $falseExpression)
39
    {
40
        $this->testExpression = $testExpression;
41
        $this->trueExpression = $trueExpression;
42
        $this->falseExpression = $falseExpression;
43
    }
44
45
    /**
46
     * @inheritDoc
47
     */
48
    public function getExpressionKind(): ExpressionKind
49
    {
50
        return ExpressionKind::If();
51
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56
    public function getTestExpression(): IExpression
57
    {
58
        return $this->testExpression;
59
    }
60
61
    /**
62
     * @inheritDoc
63
     */
64
    public function getTrueExpression(): IExpression
65
    {
66
        return $this->trueExpression;
67
    }
68
69
    /**
70
     * @inheritDoc
71
     */
72
    public function getFalseExpression(): IExpression
73
    {
74
        return $this->falseExpression;
75
    }
76
}