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

EdmLabeledExpression::getExpressionKind()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace AlgoWeb\ODataMetadata\Library\Expressions;
5
6
use AlgoWeb\ODataMetadata\Enums\ExpressionKind;
7
use AlgoWeb\ODataMetadata\Interfaces\Expressions\IExpression;
8
use AlgoWeb\ODataMetadata\Interfaces\Expressions\ILabeledExpression;
9
use AlgoWeb\ODataMetadata\Library\EdmElement;
10
11
/**
12
 * Represents an EDM labeled expression.
13
 * @package AlgoWeb\ODataMetadata\Library\Expressions
14
 */
15
class EdmLabeledExpression extends EdmElement implements ILabeledExpression
16
{
17
    /**
18
     * @var string
19
     */
20
    private $name;
21
    /**
22
     * @var IExpression
23
     */
24
        private $expression;
25
26
    /**
27
     * Initializes a new instance of the EdmLabeledExpression class.
28
     * @param string $name Label of the expression.
29
     * @param IExpression $expression Underlying expression.
30
     */
31
    public function __construct(string $name, IExpression $expression)
32
    {
33
        $this->name = $name;
34
        $this->expression = $expression;
35
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40
    public function getExpressionKind(): ExpressionKind
41
    {
42
        return ExpressionKind::Labeled();
43
    }
44
45
    /**
46
     * @inheritDoc
47
     */
48
    public function getExpression(): IExpression
49
    {
50
        return $this->expression;
51
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56
    public function getName(): string
57
    {
58
        return $this->name;
59
    }
60
}