Passed
Push — master ( bc609e...49bb39 )
by Alex
03:56
created

TAssociationSetMappingType::getEndProperty()   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 0
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\mapping\cs;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\IsOKTraits\TQualifiedNameTrait;
7
use AlgoWeb\ODataMetadata\MetadataV4\edm\IsOKTraits\TSimpleIdentifierTrait;
8
9
/**
10
 * Class representing TAssociationSetMappingType
11
 *
12
 *
13
 * XSD Type: TAssociationSetMapping
14
 */
15
class TAssociationSetMappingType extends IsOK
16
{
17
    use TSimpleIdentifierTrait, TQualifiedNameTrait;
18
    /**
19
     * @property string $name
20
     */
21
    private $name = null;
22
23
    /**
24
     * @property string $typeName
25
     */
26
    private $typeName = null;
27
28
    /**
29
     * @property string $storeEntitySet
30
     */
31
    private $storeEntitySet = null;
32
33
    /**
34
     * @property string $queryView
35
     */
36
    private $queryView = null;
37
38
    /**
39
     * @property \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEndPropertyType[] $endProperty
40
     */
41
    private $endProperty = [];
42
43
    /**
44
     * @property \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TConditionType[] $condition
45
     */
46
    private $condition = [];
47
48
    /**
49
     * @property \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TAssociationSetModificationFunctionMappingType
50
     * $modificationFunctionMapping
51
     */
52
    private $modificationFunctionMapping = null;
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 queryView
122
     *
123
     * @return string
124
     */
125
    public function getQueryView()
126
    {
127
        return $this->queryView;
128
    }
129
130
    /**
131
     * Sets a new queryView
132
     *
133
     * @param string $queryView
134
     * @return self
135
     */
136
    public function setQueryView($queryView)
137
    {
138
        $this->queryView = $queryView;
139
        return $this;
140
    }
141
142
    /**
143
     * Adds as endProperty
144
     *
145
     * @return self
146
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEndPropertyType $endProperty
147
     */
148
    public function addToEndProperty(TEndPropertyType $endProperty)
149
    {
150
        $this->endProperty[] = $endProperty;
151
        return $this;
152
    }
153
154
    /**
155
     * isset endProperty
156
     *
157
     * @param scalar $index
158
     * @return boolean
159
     */
160
    public function issetEndProperty($index)
161
    {
162
        return isset($this->endProperty[$index]);
163
    }
164
165
    /**
166
     * unset endProperty
167
     *
168
     * @param scalar $index
169
     * @return void
170
     */
171
    public function unsetEndProperty($index)
172
    {
173
        unset($this->endProperty[$index]);
174
    }
175
176
    /**
177
     * Gets as endProperty
178
     *
179
     * @return \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEndPropertyType[]
180
     */
181
    public function getEndProperty()
182
    {
183
        return $this->endProperty;
184
    }
185
186
    /**
187
     * Sets a new endProperty
188
     *
189
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEndPropertyType[] $endProperty
190
     * @return self
191
     */
192
    public function setEndProperty(array $endProperty)
193
    {
194
        $this->endProperty = $endProperty;
195
        return $this;
196
    }
197
198
    /**
199
     * Adds as condition
200
     *
201
     * @return self
202
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TConditionType $condition
203
     */
204
    public function addToCondition(TConditionType $condition)
205
    {
206
        $this->condition[] = $condition;
207
        return $this;
208
    }
209
210
    /**
211
     * isset condition
212
     *
213
     * @param scalar $index
214
     * @return boolean
215
     */
216
    public function issetCondition($index)
217
    {
218
        return isset($this->condition[$index]);
219
    }
220
221
    /**
222
     * unset condition
223
     *
224
     * @param scalar $index
225
     * @return void
226
     */
227
    public function unsetCondition($index)
228
    {
229
        unset($this->condition[$index]);
230
    }
231
232
    /**
233
     * Gets as condition
234
     *
235
     * @return \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TConditionType[]
236
     */
237
    public function getCondition()
238
    {
239
        return $this->condition;
240
    }
241
242
    /**
243
     * Sets a new condition
244
     *
245
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TConditionType[] $condition
246
     * @return self
247
     */
248
    public function setCondition(array $condition)
249
    {
250
        $this->condition = $condition;
251
        return $this;
252
    }
253
254
    /**
255
     * Gets as modificationFunctionMapping
256
     *
257
     * @return \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TAssociationSetModificationFunctionMappingType
258
     */
259
    public function getModificationFunctionMapping()
260
    {
261
        return $this->modificationFunctionMapping;
262
    }
263
264
    /**
265
     * Sets a new modificationFunctionMapping
266
     *
267
     * @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TAssociationSetModificationFunctionMappingType
268
     * $modificationFunctionMapping
269
     * @return self
270
     */
271
    public function setModificationFunctionMapping(TAssociationSetModificationFunctionMappingType $modificationFunctionMapping)
272
    {
273
        $this->modificationFunctionMapping = $modificationFunctionMapping;
274
        return $this;
275
    }
276
    
277
    public function isOK(&$msg = null)
278
    {
279
        if (!$this->isStringNotNullOrEmpty($this->name)) {
280
            $msg = 'Name cannot be null or empty';
281
            return false;
282
        }
283 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...
284
            $msg = 'Type name cannot be empty';
285
            return false;
286
        }
287 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...
288
            $msg = 'Store entity set cannot be empty';
289
            return false;
290
        }
291
        if (null != $this->queryView && !$this->isStringNotNullOrEmpty($this->queryView)) {
292
            $msg = 'Query view cannot be empty';
293
            return false;
294
        }
295
296
        if (!$this->isTSimpleIdentifierValid($this->name)) {
297
            $msg = 'Name must be a valid TSimpleIdentifier';
298
            return false;
299
        }
300
        if (null != $this->typeName && !$this->isTQualifiedNameValid($this->typeName)) {
301
            $msg = 'Type name must be a valid TQualifiedName';
302
            return false;
303
        }
304
        if (null != $this->modificationFunctionMapping && !$this->modificationFunctionMapping->isOK($msg)) {
305
            return false;
306
        }
307
        if (!$this->isValidArray(
308
            $this->endProperty,
309
            '\AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TEndPropertyType',
310
            0,
311
            2
312
        )) {
313
            $msg = "End property array not a valid array, or has more than 2 elements";
314
            return false;
315
        }
316
        if (!$this->isChildArrayOK($this->endProperty, $msg)) {
317
            return false;
318
        }
319
        if (!$this->isValidArray(
320
            $this->endProperty,
321
            '\AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TConditionType'
322
        )) {
323
            $msg = "Condition array not a valid array";
324
            return false;
325
        }
326
        if (!$this->isChildArrayOK($this->condition, $msg)) {
327
            return false;
328
        }
329
330
        return true;
331
    }
332
}
333