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

EntityContainer::setEntitySet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
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\IsOKTraits\IsOKToolboxTrait;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType;
9
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType;
10
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType;
11
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait;
12
13
/**
14
 * Class representing EntityContainer
15
 */
16
class EntityContainer extends IsOK
17
{
18
    use IsOKToolboxTrait, TSimpleIdentifierTrait, AccessTypeTraits;
19
    /**
20
     * @property string $name
21
     */
22
    private $name = null;
23
24
    /**
25
     * @property string $extends
26
     */
27
    private $extends = null;
28
29
    /**
30
     * @property string $typeAccess
31
     */
32
    private $typeAccess = null;
33
34
    /**
35
     * @property boolean $lazyLoadingEnabled
36
     */
37
    private $lazyLoadingEnabled = null;
38
39
    /**
40
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation
41
     */
42
    private $documentation = null;
43
44
    /**
45
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType[]
46
     * $functionImport
47
     */
48
    private $functionImport = [];
49
50
    /**
51
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType[] $entitySet
52
     */
53
    private $entitySet = [];
54
55
    /**
56
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType[]
57
     * $associationSet
58
     */
59
    private $associationSet = [];
60
61
    /**
62
     * Gets as name
63
     *
64
     * @return string
65
     */
66
    public function getName()
67
    {
68
        return $this->name;
69
    }
70
71
    /**
72
     * Sets a new name
73
     *
74
     * @param string $name
75
     * @return self
76
     */
77
    public function setName($name)
78
    {
79
        $this->name = $name;
80
        return $this;
81
    }
82
83
    /**
84
     * Gets as extends
85
     *
86
     * @return string
87
     */
88
    public function getExtends()
89
    {
90
        return $this->extends;
91
    }
92
93
    /**
94
     * Sets a new extends
95
     *
96
     * @param string $extends
97
     * @return self
98
     */
99
    public function setExtends($extends)
100
    {
101
        $this->extends = $extends;
102
        return $this;
103
    }
104
105
    /**
106
     * Gets as typeAccess
107
     *
108
     * @return string
109
     */
110
    public function getTypeAccess()
111
    {
112
        return $this->typeAccess;
113
    }
114
115
    /**
116
     * Sets a new typeAccess
117
     *
118
     * @param string $typeAccess
119
     * @return self
120
     */
121
    public function setTypeAccess($typeAccess)
122
    {
123
        $this->typeAccess = $typeAccess;
124
        return $this;
125
    }
126
127
    /**
128
     * Gets as lazyLoadingEnabled
129
     *
130
     * @return boolean
131
     */
132
    public function getLazyLoadingEnabled()
133
    {
134
        return $this->lazyLoadingEnabled;
135
    }
136
137
    /**
138
     * Sets a new lazyLoadingEnabled
139
     *
140
     * @param boolean $lazyLoadingEnabled
141
     * @return self
142
     */
143
    public function setLazyLoadingEnabled($lazyLoadingEnabled)
144
    {
145
        $this->lazyLoadingEnabled = $lazyLoadingEnabled;
146
        return $this;
147
    }
148
149
    /**
150
     * Gets as documentation
151
     *
152
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType
153
     */
154
    public function getDocumentation()
155
    {
156
        return $this->documentation;
157
    }
158
159
    /**
160
     * Sets a new documentation
161
     *
162
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation
163
     * @return self
164
     */
165
    public function setDocumentation(TDocumentationType $documentation)
166
    {
167
        $this->documentation = $documentation;
168
        return $this;
169
    }
170
171
    /**
172
     * Adds as functionImport
173
     *
174
     * @return self
175
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType
176
     * $functionImport
177
     */
178
    public function addToFunctionImport(FunctionImportAnonymousType $functionImport)
179
    {
180
        $this->functionImport[] = $functionImport;
181
        return $this;
182
    }
183
184
    /**
185
     * isset functionImport
186
     *
187
     * @param scalar $index
188
     * @return boolean
189
     */
190
    public function issetFunctionImport($index)
191
    {
192
        return isset($this->functionImport[$index]);
193
    }
194
195
    /**
196
     * unset functionImport
197
     *
198
     * @param scalar $index
199
     * @return void
200
     */
201
    public function unsetFunctionImport($index)
202
    {
203
        unset($this->functionImport[$index]);
204
    }
205
206
    /**
207
     * Gets as functionImport
208
     *
209
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType[]
210
     */
211
    public function getFunctionImport()
212
    {
213
        return $this->functionImport;
214
    }
215
216
    /**
217
     * Sets a new functionImport
218
     *
219
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType[]
220
     * $functionImport
221
     * @return self
222
     */
223
    public function setFunctionImport(array $functionImport)
224
    {
225
        $this->functionImport = $functionImport;
226
        return $this;
227
    }
228
229
    /**
230
     * Adds as entitySet
231
     *
232
     * @return self
233
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType $entitySet
234
     */
235
    public function addToEntitySet(EntitySetAnonymousType $entitySet)
236
    {
237
        $this->entitySet[] = $entitySet;
238
        return $this;
239
    }
240
241
    /**
242
     * isset entitySet
243
     *
244
     * @param scalar $index
245
     * @return boolean
246
     */
247
    public function issetEntitySet($index)
248
    {
249
        return isset($this->entitySet[$index]);
250
    }
251
252
    /**
253
     * unset entitySet
254
     *
255
     * @param scalar $index
256
     * @return void
257
     */
258
    public function unsetEntitySet($index)
259
    {
260
        unset($this->entitySet[$index]);
261
    }
262
263
    /**
264
     * Gets as entitySet
265
     *
266
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType[]
267
     */
268
    public function getEntitySet()
269
    {
270
        return $this->entitySet;
271
    }
272
273
    /**
274
     * Sets a new entitySet
275
     *
276
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType[] $entitySet
277
     * @return self
278
     */
279
    public function setEntitySet(array $entitySet)
280
    {
281
        $this->entitySet = $entitySet;
282
        return $this;
283
    }
284
285
    /**
286
     * Adds as associationSet
287
     *
288
     * @return self
289
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType
290
     * $associationSet
291
     */
292
    public function addToAssociationSet(AssociationSetAnonymousType $associationSet)
293
    {
294
        $this->associationSet[] = $associationSet;
295
        return $this;
296
    }
297
298
    /**
299
     * isset associationSet
300
     *
301
     * @param scalar $index
302
     * @return boolean
303
     */
304
    public function issetAssociationSet($index)
305
    {
306
        return isset($this->associationSet[$index]);
307
    }
308
309
    /**
310
     * unset associationSet
311
     *
312
     * @param scalar $index
313
     * @return void
314
     */
315
    public function unsetAssociationSet($index)
316
    {
317
        unset($this->associationSet[$index]);
318
    }
319
320
    /**
321
     * Gets as associationSet
322
     *
323
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType[]
324
     */
325
    public function getAssociationSet()
326
    {
327
        return $this->associationSet;
328
    }
329
330
    /**
331
     * Sets a new associationSet
332
     *
333
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType[]
334
     * $associationSet
335
     * @return self
336
     */
337
    public function setAssociationSet(array $associationSet)
338
    {
339
        $this->associationSet = $associationSet;
340
        return $this;
341
    }
342
343
    public function isOK(&$msg = null)
344
    {
345
        if (!$this->isTSimpleIdentifierValid($this->name)) {
346
            $msg = "Name must be a valid TSimpleIdentifier";
347
            return false;
348
        }
349
        if (null != $this->extends && !$this->isTSimpleIdentifierValid($this->extends)) {
350
            $msg = "Extends must be a valid TSimpleIdentifier";
351
            return false;
352
        }
353
        if (null != $this->typeAccess && !($this->isTPublicOrInternalAccessOK($this->typeAccess))) {
354
            $msg = "Type access must be Public or Internal";
355
            return false;
356
        }
357
        if (null != $this->isObjectNullOrOK($this->documentation, $msg)) {
358
            return false;
359
        }
360
361
        if (!$this->isValidArrayOK(
362
            $this->functionImport,
363
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType',
364
            $msg
365
        )) {
366
            return false;
367
        }
368
369
        if (!$this->isValidArrayOK(
370
            $this->entitySet,
371
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType',
372
            $msg
373
        )) {
374
            return false;
375
        }
376
377
        if (!$this->isValidArrayOK(
378
            $this->associationSet,
379
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType',
380
            $msg
381
        )) {
382
            return false;
383
        }
384
385
        return true;
386
    }
387
}
388