Passed
Pull Request — master (#51)
by Christopher
03:00
created

EdmCollectionExpression::getDeclaredType()   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\EdmUtil;
7
use AlgoWeb\ODataMetadata\Enums\ExpressionKind;
8
use AlgoWeb\ODataMetadata\Interfaces\Expressions\ICollectionExpression;
9
use AlgoWeb\ODataMetadata\Interfaces\Expressions\IExpression;
10
use AlgoWeb\ODataMetadata\Interfaces\ITypeReference;
11
use AlgoWeb\ODataMetadata\Library\EdmElement;
12
13
/**
14
 * Represents an EDM multi-value construction expression.
15
 *
16
 * @package AlgoWeb\ODataMetadata\Library\Expressions
17
 */
18
class EdmCollectionExpression extends EdmElement implements ICollectionExpression
19
{
20
    /**
21
     * @var ITypeReference
22
     */
23
    private $declaredType;
24
    /**
25
     * @var IExpression[]
26
     */
27
    private $elements;
28
29
    /**
30
     * Initializes a new instance of the EdmCollectionExpression class.
31
     * @param ITypeReference $declaredType Declared type of the collection.
32
     * @param IExpression[] $elements The constructed element values.
33
     */
34
    public function __construct(ITypeReference $declaredType, IExpression ...$elements)
35
    {
36
        EdmUtil::CheckArgumentNull($elements, "elements");
37
        $this->declaredType = $declaredType;
38
        $this->elements = $elements;
39
    }
40
41
    /**
42
     * @inheritDoc
43
     */
44
    public function getDeclaredType(): ITypeReference
45
    {
46
        return $this->declaredType;
47
    }
48
49
    /**
50
     * @inheritDoc
51
     */
52
    public function getElements(): array
53
    {
54
        return $this->elements;
55
    }
56
57
    /**
58
     * @inheritDoc
59
     */
60
    public function getExpressionKind(): ExpressionKind
61
    {
62
        return ExpressionKind::Collection();
63
    }
64
}