Passed
Push — master ( d2da49...fac384 )
by Alex
03:51
created

TSchemaType::issetAssociation()   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\ssdl;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TQualifiedNameTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TSimpleIdentifierTrait;
8
9
/**
10
 * Class representing TSchemaType
11
 *
12
 *
13
 * XSD Type: TSchema
14
 */
15
class TSchemaType extends IsOK
16
{
17
    use TQualifiedNameTrait, TSimpleIdentifierTrait;
18
    /**
19
     * @property string $namespace
20
     */
21
    private $namespace = null;
22
23
    /**
24
     * @property string $alias
25
     */
26
    private $alias = null;
27
28
    /**
29
     * @property string $provider
30
     */
31
    private $provider = null;
32
33
    /**
34
     * @property string $providerManifestToken
35
     */
36
    private $providerManifestToken = null;
37
38
    /**
39
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType[] $association
40
     */
41
    private $association = [];
42
43
    /**
44
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType[] $entityType
45
     */
46
    private $entityType = [];
47
48
    /**
49
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer[] $entityContainer
50
     */
51
    private $entityContainer = [];
52
53
    /**
54
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType[] $function
55
     */
56
    private $function = [];
57
58
    /**
59
     * Gets as namespace
60
     *
61
     * @return string
62
     */
63
    public function getNamespace()
64
    {
65
        return $this->namespace;
66
    }
67
68
    /**
69
     * Sets a new namespace
70
     *
71
     * @param string $namespace
72
     * @return self
73
     */
74
    public function setNamespace($namespace)
75
    {
76
        $this->namespace = $namespace;
77
        return $this;
78
    }
79
80
    /**
81
     * Gets as alias
82
     *
83
     * @return string
84
     */
85
    public function getAlias()
86
    {
87
        return $this->alias;
88
    }
89
90
    /**
91
     * Sets a new alias
92
     *
93
     * @param string $alias
94
     * @return self
95
     */
96
    public function setAlias($alias)
97
    {
98
        $this->alias = $alias;
99
        return $this;
100
    }
101
102
    /**
103
     * Gets as provider
104
     *
105
     * @return string
106
     */
107
    public function getProvider()
108
    {
109
        return $this->provider;
110
    }
111
112
    /**
113
     * Sets a new provider
114
     *
115
     * @param string $provider
116
     * @return self
117
     */
118
    public function setProvider($provider)
119
    {
120
        $this->provider = $provider;
121
        return $this;
122
    }
123
124
    /**
125
     * Gets as providerManifestToken
126
     *
127
     * @return string
128
     */
129
    public function getProviderManifestToken()
130
    {
131
        return $this->providerManifestToken;
132
    }
133
134
    /**
135
     * Sets a new providerManifestToken
136
     *
137
     * @param string $providerManifestToken
138
     * @return self
139
     */
140
    public function setProviderManifestToken($providerManifestToken)
141
    {
142
        $this->providerManifestToken = $providerManifestToken;
143
        return $this;
144
    }
145
146
    /**
147
     * Adds as association
148
     *
149
     * @return self
150
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType $association
151
     */
152
    public function addToAssociation(TAssociationType $association)
153
    {
154
        $this->association[] = $association;
155
        return $this;
156
    }
157
158
    /**
159
     * isset association
160
     *
161
     * @param scalar $index
162
     * @return boolean
163
     */
164
    public function issetAssociation($index)
165
    {
166
        return isset($this->association[$index]);
167
    }
168
169
    /**
170
     * unset association
171
     *
172
     * @param scalar $index
173
     * @return void
174
     */
175
    public function unsetAssociation($index)
176
    {
177
        unset($this->association[$index]);
178
    }
179
180
    /**
181
     * Gets as association
182
     *
183
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType[]
184
     */
185
    public function getAssociation()
186
    {
187
        return $this->association;
188
    }
189
190
    /**
191
     * Sets a new association
192
     *
193
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType[] $association
194
     * @return self
195
     */
196
    public function setAssociation(array $association)
197
    {
198
        $this->association = $association;
199
        return $this;
200
    }
201
202
    /**
203
     * Adds as entityType
204
     *
205
     * @return self
206
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType $entityType
207
     */
208
    public function addToEntityType(TEntityTypeType $entityType)
209
    {
210
        $this->entityType[] = $entityType;
211
        return $this;
212
    }
213
214
    /**
215
     * isset entityType
216
     *
217
     * @param scalar $index
218
     * @return boolean
219
     */
220
    public function issetEntityType($index)
221
    {
222
        return isset($this->entityType[$index]);
223
    }
224
225
    /**
226
     * unset entityType
227
     *
228
     * @param scalar $index
229
     * @return void
230
     */
231
    public function unsetEntityType($index)
232
    {
233
        unset($this->entityType[$index]);
234
    }
235
236
    /**
237
     * Gets as entityType
238
     *
239
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType[]
240
     */
241
    public function getEntityType()
242
    {
243
        return $this->entityType;
244
    }
245
246
    /**
247
     * Sets a new entityType
248
     *
249
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType[] $entityType
250
     * @return self
251
     */
252
    public function setEntityType(array $entityType)
253
    {
254
        $this->entityType = $entityType;
255
        return $this;
256
    }
257
258
    /**
259
     * Adds as entityContainer
260
     *
261
     * @return self
262
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer $entityContainer
263
     */
264
    public function addToEntityContainer(EntityContainer $entityContainer)
265
    {
266
        $this->entityContainer[] = $entityContainer;
267
        return $this;
268
    }
269
270
    /**
271
     * isset entityContainer
272
     *
273
     * @param scalar $index
274
     * @return boolean
275
     */
276
    public function issetEntityContainer($index)
277
    {
278
        return isset($this->entityContainer[$index]);
279
    }
280
281
    /**
282
     * unset entityContainer
283
     *
284
     * @param scalar $index
285
     * @return void
286
     */
287
    public function unsetEntityContainer($index)
288
    {
289
        unset($this->entityContainer[$index]);
290
    }
291
292
    /**
293
     * Gets as entityContainer
294
     *
295
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer[]
296
     */
297
    public function getEntityContainer()
298
    {
299
        return $this->entityContainer;
300
    }
301
302
    /**
303
     * Sets a new entityContainer
304
     *
305
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer[] $entityContainer
306
     * @return self
307
     */
308
    public function setEntityContainer(array $entityContainer)
309
    {
310
        $this->entityContainer = $entityContainer;
311
        return $this;
312
    }
313
314
    /**
315
     * Adds as function
316
     *
317
     * @return self
318
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType $function
319
     */
320
    public function addToFunction(TFunctionType $function)
321
    {
322
        $this->function[] = $function;
323
        return $this;
324
    }
325
326
    /**
327
     * isset function
328
     *
329
     * @param scalar $index
330
     * @return boolean
331
     */
332
    public function issetFunction($index)
333
    {
334
        return isset($this->function[$index]);
335
    }
336
337
    /**
338
     * unset function
339
     *
340
     * @param scalar $index
341
     * @return void
342
     */
343
    public function unsetFunction($index)
344
    {
345
        unset($this->function[$index]);
346
    }
347
348
    /**
349
     * Gets as function
350
     *
351
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType[]
352
     */
353
    public function getFunction()
354
    {
355
        return $this->function;
356
    }
357
358
    /**
359
     * Sets a new function
360
     *
361
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType[] $function
362
     * @return self
363
     */
364
    public function setFunction(array $function)
365
    {
366
        $this->function = $function;
367
        return $this;
368
    }
369
370
    public function isOK(&$msg = null)
371
    {
372
        if (!$this->isStringNotNullOrEmpty($this->namespace)) {
373
            $msg = "Namespace cannot be null or empty";
374
            return false;
375
        }
376
        if (!$this->isStringNotNullOrEmpty($this->provider)) {
377
            $msg = "Provider cannot be null or empty";
378
            return false;
379
        }
380
        if (!$this->isStringNotNullOrEmpty($this->providerManifestToken)) {
381
            $msg = "Provider manifest token cannot be null or empty";
382
            return false;
383
        }
384
        if (!$this->isStringNotNullOrEmpty($this->alias)) {
385
            $msg = "Alias cannot be empty";
386
            return false;
387
        }
388
        if (!$this->isTQualifiedNameValid($this->namespace)) {
389
            $msg = "Namespace must be valid TQualifiedName";
390
            return false;
391
        }
392
        if (null != $this->alias && !$this->isTSimpleIdentifierValid($this->alias)) {
393
            $msg = "Alias must be valid TSimpleIdentifier";
394
            return false;
395
        }
396
        if (null != $this->providerManifestToken && !$this->isTSimpleIdentifierValid($this->providerManifestToken)) {
397
            $msg = "Provider manifest token must be valid TSimpleIdentifier";
398
            return false;
399
        }
400
        if (!$this->isTSimpleIdentifierValid($this->provider)) {
401
            $msg = "Provider must be valid TSimpleIdentifier";
402
            return false;
403
        }
404
        if (!$this->isValidArrayOK(
405
            $this->association,
406
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TAssociationType',
407
            $msg
408
        )) {
409
            return false;
410
        }
411
        if (!$this->isValidArrayOK(
412
            $this->entityType,
413
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TEntityTypeType',
414
            $msg
415
        )) {
416
            return false;
417
        }
418
        if (!$this->isValidArrayOK(
419
            $this->entityContainer,
420
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\EntityContainer',
421
            $msg,
422
            1
423
        )) {
424
            return false;
425
        }
426
        if (!$this->isValidArrayOK(
427
            $this->function,
428
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionType',
429
            $msg
430
        )) {
431
            return false;
432
        }
433
434
        return true;
435
    }
436
}
437