Passed
Push — master ( 189420...0898fe )
by Alex
04:14
created

TAnnotationsType::unsetTypeAnnotation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TQualifiedNameTrait;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait;
9
10
/**
11
 * Class representing TAnnotationsType
12
 *
13
 *
14
 * XSD Type: TAnnotations
15
 */
16
class TAnnotationsType extends IsOK
17
{
18
    use IsOKToolboxTrait, TQualifiedNameTrait, TSimpleIdentifierTrait;
19
    /**
20
     * @property string $target
21
     */
22
    private $target = null;
23
24
    /**
25
     * @property string $qualifier
26
     */
27
    private $qualifier = null;
28
29
    /**
30
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation
31
     */
32
    private $valueAnnotation = [];
33
34
    /**
35
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation
36
     */
37
    private $typeAnnotation = [];
38
39
    /**
40
     * Gets as target
41
     *
42
     * @return string
43
     */
44
    public function getTarget()
45
    {
46
        return $this->target;
47
    }
48
49
    /**
50
     * Sets a new target
51
     *
52
     * @param string $target
53
     * @return self
54
     */
55
    public function setTarget($target)
56
    {
57
        $this->target = $target;
58
        return $this;
59
    }
60
61
    /**
62
     * Gets as qualifier
63
     *
64
     * @return string
65
     */
66
    public function getQualifier()
67
    {
68
        return $this->qualifier;
69
    }
70
71
    /**
72
     * Sets a new qualifier
73
     *
74
     * @param string $qualifier
75
     * @return self
76
     */
77
    public function setQualifier($qualifier)
78
    {
79
        $this->qualifier = $qualifier;
80
        return $this;
81
    }
82
83
    /**
84
     * Adds as valueAnnotation
85
     *
86
     * @return self
87
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType $valueAnnotation
88
     */
89
    public function addToValueAnnotation(TValueAnnotationType $valueAnnotation)
90
    {
91
        $this->valueAnnotation[] = $valueAnnotation;
92
        return $this;
93
    }
94
95
    /**
96
     * isset valueAnnotation
97
     *
98
     * @param scalar $index
99
     * @return boolean
100
     */
101
    public function issetValueAnnotation($index)
102
    {
103
        return isset($this->valueAnnotation[$index]);
104
    }
105
106
    /**
107
     * unset valueAnnotation
108
     *
109
     * @param scalar $index
110
     * @return void
111
     */
112
    public function unsetValueAnnotation($index)
113
    {
114
        unset($this->valueAnnotation[$index]);
115
    }
116
117
    /**
118
     * Gets as valueAnnotation
119
     *
120
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[]
121
     */
122
    public function getValueAnnotation()
123
    {
124
        return $this->valueAnnotation;
125
    }
126
127
    /**
128
     * Sets a new valueAnnotation
129
     *
130
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation
131
     * @return self
132
     */
133
    public function setValueAnnotation(array $valueAnnotation)
134
    {
135
        $this->valueAnnotation = $valueAnnotation;
136
        return $this;
137
    }
138
139
    /**
140
     * Adds as typeAnnotation
141
     *
142
     * @return self
143
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType $typeAnnotation
144
     */
145
    public function addToTypeAnnotation(TTypeAnnotationType $typeAnnotation)
146
    {
147
        $this->typeAnnotation[] = $typeAnnotation;
148
        return $this;
149
    }
150
151
    /**
152
     * isset typeAnnotation
153
     *
154
     * @param scalar $index
155
     * @return boolean
156
     */
157
    public function issetTypeAnnotation($index)
158
    {
159
        return isset($this->typeAnnotation[$index]);
160
    }
161
162
    /**
163
     * unset typeAnnotation
164
     *
165
     * @param scalar $index
166
     * @return void
167
     */
168
    public function unsetTypeAnnotation($index)
169
    {
170
        unset($this->typeAnnotation[$index]);
171
    }
172
173
    /**
174
     * Gets as typeAnnotation
175
     *
176
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[]
177
     */
178
    public function getTypeAnnotation()
179
    {
180
        return $this->typeAnnotation;
181
    }
182
183
    /**
184
     * Sets a new typeAnnotation
185
     *
186
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation
187
     * @return self
188
     */
189
    public function setTypeAnnotation(array $typeAnnotation)
190
    {
191
        $this->typeAnnotation = $typeAnnotation;
192
        return $this;
193
    }
194
195
    public function isOK(&$msg = null)
196
    {
197
        if (!$this->isTQualifiedNameValid($this->target)) {
198
            $msg = "Target must be a valid TQualifiedName";
199
            return false;
200
        }
201
        if (null != $this->qualifier && !$this->isTSimpleIdentifierValid($this->qualifier)) {
202
            $msg = "Qualifier must be a valid TSimpleIdentifier";
203
            return false;
204
        }
205
        if (!$this->isValidArrayOk(
206
            $this->valueAnnotation,
207
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType',
208
            $msg
209
        )) {
210
            return false;
211
        }
212
        if (!$this->isValidArrayOk(
213
            $this->typeAnnotation,
214
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType',
215
            $msg
216
        )) {
217
            return false;
218
        }
219
220
        return true;
221
    }
222
}
223