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

TComplexTypeType::isOK()   C

Complexity

Conditions 7
Paths 7

Size

Total Lines 36
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 6.7272
c 0
b 0
f 0
cc 7
eloc 24
nc 7
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm;
4
5
use AlgoWeb\ODataMetadata\CodeGeneration\AccessTypeTraits;
6
use AlgoWeb\ODataMetadata\IsOK;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\TTypeAttributesTrait;
8
9
/**
10
 * Class representing TComplexTypeType
11
 *
12
 *
13
 * XSD Type: TComplexType
14
 */
15
class TComplexTypeType extends IsOK
16
{
17
    use TTypeAttributesTrait, AccessTypeTraits;
18
19
    /**
20
     * @property string $typeAccess
21
     */
22
    private $typeAccess = null;
23
24
    /**
25
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation
26
     */
27
    private $documentation = null;
28
29
    /**
30
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypePropertyType[] $property
31
     */
32
    private $property = [];
33
34
    /**
35
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation
36
     */
37
    private $valueAnnotation = [];
38
39
    /**
40
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation
41
     */
42
    private $typeAnnotation = [];
43
44
    /**
45
     * Gets as typeAccess
46
     *
47
     * @return string
48
     */
49
    public function getTypeAccess()
50
    {
51
        return $this->typeAccess;
52
    }
53
54
    /**
55
     * Sets a new typeAccess
56
     *
57
     * @param string $typeAccess
58
     * @return self
59
     */
60
    public function setTypeAccess($typeAccess)
61
    {
62
        $this->typeAccess = $typeAccess;
63
        return $this;
64
    }
65
66
    /**
67
     * Gets as documentation
68
     *
69
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType
70
     */
71
    public function getDocumentation()
72
    {
73
        return $this->documentation;
74
    }
75
76
    /**
77
     * Sets a new documentation
78
     *
79
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation
80
     * @return self
81
     */
82
    public function setDocumentation(TDocumentationType $documentation)
83
    {
84
        $this->documentation = $documentation;
85
        return $this;
86
    }
87
88
    /**
89
     * Adds as property
90
     *
91
     * @return self
92
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypePropertyType $property
93
     */
94
    public function addToProperty(TComplexTypePropertyType $property)
95
    {
96
        $this->property[] = $property;
97
        return $this;
98
    }
99
100
    /**
101
     * isset property
102
     *
103
     * @param scalar $index
104
     * @return boolean
105
     */
106
    public function issetProperty($index)
107
    {
108
        return isset($this->property[$index]);
109
    }
110
111
    /**
112
     * unset property
113
     *
114
     * @param scalar $index
115
     * @return void
116
     */
117
    public function unsetProperty($index)
118
    {
119
        unset($this->property[$index]);
120
    }
121
122
    /**
123
     * Gets as property
124
     *
125
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypePropertyType[]
126
     */
127
    public function getProperty()
128
    {
129
        return $this->property;
130
    }
131
132
    /**
133
     * Sets a new property
134
     *
135
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypePropertyType[] $property
136
     * @return self
137
     */
138
    public function setProperty(array $property)
139
    {
140
        $this->property = $property;
141
        return $this;
142
    }
143
144
    /**
145
     * Adds as valueAnnotation
146
     *
147
     * @return self
148
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType $valueAnnotation
149
     */
150
    public function addToValueAnnotation(TValueAnnotationType $valueAnnotation)
151
    {
152
        $this->valueAnnotation[] = $valueAnnotation;
153
        return $this;
154
    }
155
156
    /**
157
     * isset valueAnnotation
158
     *
159
     * @param scalar $index
160
     * @return boolean
161
     */
162
    public function issetValueAnnotation($index)
163
    {
164
        return isset($this->valueAnnotation[$index]);
165
    }
166
167
    /**
168
     * unset valueAnnotation
169
     *
170
     * @param scalar $index
171
     * @return void
172
     */
173
    public function unsetValueAnnotation($index)
174
    {
175
        unset($this->valueAnnotation[$index]);
176
    }
177
178
    /**
179
     * Gets as valueAnnotation
180
     *
181
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[]
182
     */
183
    public function getValueAnnotation()
184
    {
185
        return $this->valueAnnotation;
186
    }
187
188
    /**
189
     * Sets a new valueAnnotation
190
     *
191
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation
192
     * @return self
193
     */
194
    public function setValueAnnotation(array $valueAnnotation)
195
    {
196
        $this->valueAnnotation = $valueAnnotation;
197
        return $this;
198
    }
199
200
    /**
201
     * Adds as typeAnnotation
202
     *
203
     * @return self
204
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType $typeAnnotation
205
     */
206
    public function addToTypeAnnotation(TTypeAnnotationType $typeAnnotation)
207
    {
208
        $this->typeAnnotation[] = $typeAnnotation;
209
        return $this;
210
    }
211
212
    /**
213
     * isset typeAnnotation
214
     *
215
     * @param scalar $index
216
     * @return boolean
217
     */
218
    public function issetTypeAnnotation($index)
219
    {
220
        return isset($this->typeAnnotation[$index]);
221
    }
222
223
    /**
224
     * unset typeAnnotation
225
     *
226
     * @param scalar $index
227
     * @return void
228
     */
229
    public function unsetTypeAnnotation($index)
230
    {
231
        unset($this->typeAnnotation[$index]);
232
    }
233
234
    /**
235
     * Gets as typeAnnotation
236
     *
237
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[]
238
     */
239
    public function getTypeAnnotation()
240
    {
241
        return $this->typeAnnotation;
242
    }
243
244
    /**
245
     * Sets a new typeAnnotation
246
     *
247
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation
248
     * @return self
249
     */
250
    public function setTypeAnnotation(array $typeAnnotation)
251
    {
252
        $this->typeAnnotation = $typeAnnotation;
253
        return $this;
254
    }
255
256
    public function isOK(&$msg = null)
257
    {
258
        if ($this->isTPublicOrInternalAccessOK($this->typeAccess)) {
259
            $msg = "Type access must be Public or Internal";
260
            return false;
261
        }
262
        if (null != $this->isObjectNullOrOK($this->documentation, $msg)) {
263
            return false;
264
        }
265
        if (!$this->isValidArrayOK(
266
            $this->property,
267
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypePropertyType',
268
            $msg
269
        )) {
270
            return false;
271
        }
272
        if (!$this->isValidArrayOK(
273
            $this->valueAnnotation,
274
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType',
275
            $msg
276
        )) {
277
            return false;
278
        }
279
        if (!$this->isValidArrayOK(
280
            $this->typeAnnotation,
281
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType',
282
            $msg
283
        )) {
284
            return false;
285
        }
286
287
        if (!$this->isTTypeAttributesValid($msg)) {
288
            return false;
289
        }
290
        return true;
291
    }
292
}
293