Passed
Pull Request — master (#52)
by Christopher
05:24 queued 02:20
created

EdmDirectValueAnnotation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getNamespaceUri() 0 3 1
A getValue() 0 3 1
1
<?php
2
3
4
namespace AlgoWeb\ODataMetadata\Library\Annotations;
5
6
use AlgoWeb\ODataMetadata\EdmUtil;
7
use AlgoWeb\ODataMetadata\Interfaces\Annotations\IDirectValueAnnotation;
8
use AlgoWeb\ODataMetadata\Library\EdmNamedElement;
9
10
/**
11
 * Represents an EDM annotation with an immediate native value.
12
 *
13
 * @package AlgoWeb\ODataMetadata\Library\Annotations
14
 */
15
class EdmDirectValueAnnotation extends EdmNamedElement implements IDirectValueAnnotation
16
{
17
    /**
18
     * @var mixed
19
     */
20
private $value;
21
    /**
22
     * @var string
23
     */
24
private $namespaceUri;
25
26
    /**
27
     * Initializes a new instance of the EdmDirectValueAnnotation class.
28
     * @param string $namespaceUri Namespace URI of the annotation.
29
     * @param string $name Name of the annotation within the namespace.
30
     * @param mixed $value Value of the annotation
31
     */
32
public function __construct(string $namespaceUri, string $name, $value)
33
{
34
    parent::__construct($name);
35
    $this->namespaceUri = $namespaceUri;
36
    //EdmUtil::checkArgumentNull($value, 'value'); TODO: idealy they should be able to provide a null value, but the value should be optional.
37
    $this->value = $value;
38
}
39
40
    /**
41
     * @inheritDoc
42
     */
43
    public function getNamespaceUri(): string
44
    {
45
        return $this->namespaceUri;
46
    }
47
48
    /**
49
     * @inheritDoc
50
     */
51
    public function getValue()
52
    {
53
        return $this->value;
54
    }
55
}