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

EdmPathExpression::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
7
use AlgoWeb\ODataMetadata\Enums\ExpressionKind;
8
use AlgoWeb\ODataMetadata\Interfaces\Expressions\IPathExpression;
9
use AlgoWeb\ODataMetadata\Library\EdmElement;
10
11
/**
12
 * Represents an EDM path expression.
13
 *
14
 * @package AlgoWeb\ODataMetadata\Library\Expressions
15
 */
16
class EdmPathExpression extends EdmElement implements IPathExpression
17
{
18
    /**
19
     * @var string[]
20
     */
21
    private $path;
22
23
    /**
24
     * EdmPathExpression constructor.
25
     * @param string[] ...$path Path string containing segments seperated by '/'. For example: "A.B/C/D.E/Func1(NS.T,NS.T2)/P1". OR Path segments array
26
     */
27
    public function __construct(string ...$path)
28
    {
29
        if(count($path) === 1){
30
            $path = explode('/', $path[]);
31
        }
32
        $this->path = $path;
33
    }
34
35
    /**
36
     * @inheritDoc
37
     */
38
    public function getExpressionKind(): ExpressionKind
39
    {
40
        return ExpressionKind::Path();
41
    }
42
43
    /**
44
     * @inheritDoc
45
     */
46
    public function getPath(): array
47
    {
48
        return $this->path;
49
    }
50
}