Passed
Push — master ( 4f7966...46bec3 )
by Alex
04:29
created

TEntitySetMappingType::setScalarProperty()   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\mapping\cs;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\Groups\TPropertyGroup;
7
use AlgoWeb\ODataMetadata\MetadataV4\edm\IsOKTraits\TSimpleIdentifierTrait;
8
9
/**
10
 * Class representing TEntitySetMappingType
11
 *
12
 * Type for EntitySet mapping element
13
 *
14
 * XSD Type: TEntitySetMapping
15
 */
16
class TEntitySetMappingType extends IsOK
17
{
18
    use TSimpleIdentifierTrait, TPropertyGroup;
19
    /**
20
     * @property string $name
21
     */
22
    private $name = null;
23
24
    /**
25
     * @property string $typeName
26
     */
27
    private $typeName = null;
28
29
    /**
30
     * @property string $storeEntitySet
31
     */
32
    private $storeEntitySet = null;
33
34
    /**
35
     * @property boolean $makeColumnsDistinct
36
     */
37
    private $makeColumnsDistinct = null;
38
39
    /**
40
     * @property \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TQueryViewType[] $queryView
41
     */
42
    private $queryView = [];
43
44
    /**
45
     * @property \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEntityTypeMappingType[] $entityTypeMapping
46
     */
47
    private $entityTypeMapping = [];
48
49
    /**
50
     * @property \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TMappingFragmentType[] $mappingFragment
51
     */
52
    private $mappingFragment = [];
53
54
    /**
55
     * Gets as name
56
     *
57
     * @return string
58
     */
59
    public function getName()
60
    {
61
        return $this->name;
62
    }
63
64
    /**
65
     * Sets a new name
66
     *
67
     * @param string $name
68
     * @return self
69
     */
70
    public function setName($name)
71
    {
72
        $this->name = $name;
73
        return $this;
74
    }
75
76
    /**
77
     * Gets as typeName
78
     *
79
     * @return string
80
     */
81
    public function getTypeName()
82
    {
83
        return $this->typeName;
84
    }
85
86
    /**
87
     * Sets a new typeName
88
     *
89
     * @param string $typeName
90
     * @return self
91
     */
92
    public function setTypeName($typeName)
93
    {
94
        $this->typeName = $typeName;
95
        return $this;
96
    }
97
98
    /**
99
     * Gets as storeEntitySet
100
     *
101
     * @return string
102
     */
103
    public function getStoreEntitySet()
104
    {
105
        return $this->storeEntitySet;
106
    }
107
108
    /**
109
     * Sets a new storeEntitySet
110
     *
111
     * @param string $storeEntitySet
112
     * @return self
113
     */
114
    public function setStoreEntitySet($storeEntitySet)
115
    {
116
        $this->storeEntitySet = $storeEntitySet;
117
        return $this;
118
    }
119
120
    /**
121
     * Gets as makeColumnsDistinct
122
     *
123
     * @return boolean
124
     */
125
    public function getMakeColumnsDistinct()
126
    {
127
        return $this->makeColumnsDistinct;
128
    }
129
130
    /**
131
     * Sets a new makeColumnsDistinct
132
     *
133
     * @param boolean $makeColumnsDistinct
134
     * @return self
135
     */
136
    public function setMakeColumnsDistinct($makeColumnsDistinct)
137
    {
138
        $this->makeColumnsDistinct = $makeColumnsDistinct;
139
        return $this;
140
    }
141
142
    /**
143
     * Adds as queryView
144
     *
145
     * @return self
146
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TQueryViewType $queryView
147
     */
148
    public function addToQueryView(TQueryViewType $queryView)
149
    {
150
        $this->queryView[] = $queryView;
151
        return $this;
152
    }
153
154
    /**
155
     * isset queryView
156
     *
157
     * @param scalar $index
158
     * @return boolean
159
     */
160
    public function issetQueryView($index)
161
    {
162
        return isset($this->queryView[$index]);
163
    }
164
165
    /**
166
     * unset queryView
167
     *
168
     * @param scalar $index
169
     * @return void
170
     */
171
    public function unsetQueryView($index)
172
    {
173
        unset($this->queryView[$index]);
174
    }
175
176
    /**
177
     * Gets as queryView
178
     *
179
     * @return \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TQueryViewType[]
180
     */
181
    public function getQueryView()
182
    {
183
        return $this->queryView;
184
    }
185
186
    /**
187
     * Sets a new queryView
188
     *
189
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TQueryViewType[] $queryView
190
     * @return self
191
     */
192
    public function setQueryView(array $queryView)
193
    {
194
        $this->queryView = $queryView;
195
        return $this;
196
    }
197
198
    /**
199
     * Adds as entityTypeMapping
200
     *
201
     * @return self
202
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEntityTypeMappingType $entityTypeMapping
203
     */
204
    public function addToEntityTypeMapping(TEntityTypeMappingType $entityTypeMapping)
205
    {
206
        $this->entityTypeMapping[] = $entityTypeMapping;
207
        return $this;
208
    }
209
210
    /**
211
     * isset entityTypeMapping
212
     *
213
     * @param scalar $index
214
     * @return boolean
215
     */
216
    public function issetEntityTypeMapping($index)
217
    {
218
        return isset($this->entityTypeMapping[$index]);
219
    }
220
221
    /**
222
     * unset entityTypeMapping
223
     *
224
     * @param scalar $index
225
     * @return void
226
     */
227
    public function unsetEntityTypeMapping($index)
228
    {
229
        unset($this->entityTypeMapping[$index]);
230
    }
231
232
    /**
233
     * Gets as entityTypeMapping
234
     *
235
     * @return \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEntityTypeMappingType[]
236
     */
237
    public function getEntityTypeMapping()
238
    {
239
        return $this->entityTypeMapping;
240
    }
241
242
    /**
243
     * Sets a new entityTypeMapping
244
     *
245
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEntityTypeMappingType[] $entityTypeMapping
246
     * @return self
247
     */
248
    public function setEntityTypeMapping(array $entityTypeMapping)
249
    {
250
        $this->entityTypeMapping = $entityTypeMapping;
251
        return $this;
252
    }
253
254
    /**
255
     * Adds as mappingFragment
256
     *
257
     * @return self
258
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TMappingFragmentType $mappingFragment
259
     */
260
    public function addToMappingFragment(TMappingFragmentType $mappingFragment)
261
    {
262
        $this->mappingFragment[] = $mappingFragment;
263
        return $this;
264
    }
265
266
    /**
267
     * isset mappingFragment
268
     *
269
     * @param scalar $index
270
     * @return boolean
271
     */
272
    public function issetMappingFragment($index)
273
    {
274
        return isset($this->mappingFragment[$index]);
275
    }
276
277
    /**
278
     * unset mappingFragment
279
     *
280
     * @param scalar $index
281
     * @return void
282
     */
283
    public function unsetMappingFragment($index)
284
    {
285
        unset($this->mappingFragment[$index]);
286
    }
287
288
    /**
289
     * Gets as mappingFragment
290
     *
291
     * @return \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TMappingFragmentType[]
292
     */
293
    public function getMappingFragment()
294
    {
295
        return $this->mappingFragment;
296
    }
297
298
    /**
299
     * Sets a new mappingFragment
300
     *
301
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TMappingFragmentType[] $mappingFragment
302
     * @return self
303
     */
304
    public function setMappingFragment(array $mappingFragment)
305
    {
306
        $this->mappingFragment = $mappingFragment;
307
        return $this;
308
    }
309
310
    public function isOK(&$msg = null)
311
    {
312
        if (!$this->isStringNotNullOrEmpty($this->name)) {
313
            $msg = 'Name cannot be null or empty';
314
            return false;
315
        }
316 View Code Duplication
        if (null != $this->typeName && !$this->isStringNotNullOrEmpty($this->typeName)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
317
            $msg = 'Type name cannot be empty';
318
            return false;
319
        }
320 View Code Duplication
        if (null != $this->storeEntitySet && !$this->isStringNotNullOrEmpty($this->storeEntitySet)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
321
            $msg = 'Store entity set cannot be empty';
322
            return false;
323
        }
324
        if (!$this->isPropertyGroupOK($msg)) {
325
            return false;
326
        }
327
        if (!$this->isValidArray(
328
            $this->entityTypeMapping,
329
            '\AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEntityTypeMappingType'
330
        )) {
331
            $msg = "Mapping fragment array not a valid array";
332
            return false;
333
        }
334
        if (!$this->isChildArrayOK($this->entityTypeMapping, $msg)) {
335
            return false;
336
        }
337
        if (!$this->isValidArray(
338
            $this->queryView,
339
            '\AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEntityTypeMappingType'
340
        )) {
341
            $msg = "Query view array not a valid array";
342
            return false;
343
        }
344
        if (!$this->isChildArrayOK($this->queryView, $msg)) {
345
            return false;
346
        }
347
        if (!$this->isValidArray(
348
            $this->mappingFragment,
349
            '\AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEntityTypeMappingType'
350
        )) {
351
            $msg = "Mapping fragment array not a valid array";
352
            return false;
353
        }
354
        if (!$this->isChildArrayOK($this->mappingFragment, $msg)) {
355
            return false;
356
        }
357
358
        return true;
359
    }
360
}
361