Passed
Push — master ( cedc01...8bcd2b )
by Christopher
02:32
created

HasTypeAnnotation::XmlSerializeHasTypeAnnotation()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
6
namespace AlgoWeb\ODataMetadata\MetadataV3\Edm\Concerns;
7
8
use AlgoWeb\ODataMetadata\MetadataV3\Edm\Annotations\TypeAnnotation;
9
use DOMElement;
10
11
trait HasTypeAnnotation
12
{
13
    /**
14
     * @var TypeAnnotation[] $typeAnnotation
15
     */
16
    private $typeAnnotation = [];
17
18
19
    /**
20
     * Adds as typeAnnotation.
21
     *
22
     * @param TypeAnnotation $typeAnnotation
23
     *@return self
24
     */
25
    public function addToTypeAnnotation(TypeAnnotation $typeAnnotation): self
26
    {
27
        $this->typeAnnotation[] = $typeAnnotation;
28
        return $this;
29
    }
30
31
    /**
32
     * isset typeAnnotation.
33
     *
34
     * @param  int  $index
35
     * @return bool
36
     */
37
    public function issetTypeAnnotation(int $index): bool
38
    {
39
        return isset($this->typeAnnotation[$index]);
40
    }
41
42
    /**
43
     * unset typeAnnotation.
44
     *
45
     * @param  int  $index
46
     * @return void
47
     */
48
    public function unsetTypeAnnotation(int $index): void
49
    {
50
        unset($this->typeAnnotation[$index]);
51
    }
52
53
    /**
54
     * Gets as typeAnnotation.
55
     *
56
     * @return TypeAnnotation[]
57
     */
58
    public function getTypeAnnotation(): array
59
    {
60
        return $this->typeAnnotation;
61
    }
62
63
    /**
64
     * Sets a new typeAnnotation.
65
     *
66
     * @param  TypeAnnotation[] $typeAnnotation
67
     * @return self
68
     */
69
    public function setHasTypeAnnotation(array $typeAnnotation): self
70
    {
71
        $this->typeAnnotation = $typeAnnotation;
72
        return $this;
73
    }
74
}
75