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

EdmAssertTypeExpression   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 44
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A __construct() 0 4 1
A getExpressionKind() 0 3 1
A getOperand() 0 3 1
1
<?php
2
3
4
namespace AlgoWeb\ODataMetadata\Library\Expressions;
5
6
use AlgoWeb\ODataMetadata\Enums\ExpressionKind;
7
use AlgoWeb\ODataMetadata\Interfaces\Expressions\IAssertTypeExpression;
8
use AlgoWeb\ODataMetadata\Interfaces\Expressions\IExpression;
9
use AlgoWeb\ODataMetadata\Interfaces\ITypeReference;
10
use AlgoWeb\ODataMetadata\Library\EdmElement;
11
12
/**
13
 * Represents an EDM type assertion expression.
14
 *
15
 * @package AlgoWeb\ODataMetadata\Library\Expressions
16
 */
17
class EdmAssertTypeExpression extends EdmElement implements IAssertTypeExpression
18
{
19
    /**
20
     * @var IExpression
21
     */
22
    private $operand;
23
    /**
24
     * @var ITypeReference
25
     */
26
    private $type;
27
28
    /**
29
     * Initializes a new instance of the EdmAssertTypeExpression class.
30
     * @param IExpression $operand Expression for which the type is asserted.
31
     * @param ITypeReference $type Type to assert.
32
     */
33
    public function __construct(IExpression $operand, ITypeReference $type)
34
    {
35
        $this->operand = $operand;
36
        $this->type = $type;
37
    }
38
39
    /**
40
     * @inheritDoc
41
     */
42
    public function getOperand(): IExpression
43
    {
44
        return $this->operand;
45
    }
46
47
    /**
48
     * @inheritDoc
49
     */
50
    public function getType(): ITypeReference
51
    {
52
        return $this->type;
53
    }
54
55
    /**
56
     * @inheritDoc
57
     */
58
    public function getExpressionKind(): ExpressionKind
59
    {
60
        return ExpressionKind::AssertType();
61
    }
62
}