Passed
Push — master ( 46bec3...dbfdbf )
by Alex
04:19
created

TPropertyType::setDocumentation()   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\ssdl;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TPropertyTypeTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TSimpleIdentifierTrait;
8
9
/**
10
 * Class representing TPropertyType
11
 *
12
 *
13
 * XSD Type: TProperty
14
 */
15
class TPropertyType extends IsOK
16
{
17
    use TSimpleIdentifierTrait, TPropertyTypeTrait, GEmptyElementExtensibilityTrait;
18
    /**
19
     * @property string $name
20
     */
21
    private $name = null;
22
23
    /**
24
     * @property string $type
25
     */
26
    private $type = null;
27
28
    /**
29
     * @property boolean $nullable
30
     */
31
    private $nullable = true;
32
33
    /**
34
     * @property string $defaultValue
35
     */
36
    private $defaultValue = null;
37
38
    /**
39
     * @property string $maxLength
40
     */
41
    private $maxLength = null;
42
43
    /**
44
     * @property boolean $fixedLength
45
     */
46
    private $fixedLength = null;
47
48
    /**
49
     * @property integer $precision
50
     */
51
    private $precision = null;
52
53
    /**
54
     * @property integer $scale
55
     */
56
    private $scale = null;
57
58
    /**
59
     * @property boolean $unicode
60
     */
61
    private $unicode = null;
62
63
    /**
64
     * @property string $collation
65
     */
66
    private $collation = null;
67
68
    /**
69
     * @property string $sRID
70
     */
71
    private $sRID = null;
72
73
    /**
74
     * Gets as name
75
     *
76
     * @return string
77
     */
78
    public function getName()
79
    {
80
        return $this->name;
81
    }
82
83
    /**
84
     * Sets a new name
85
     *
86
     * @param string $name
87
     * @return self
88
     */
89
    public function setName($name)
90
    {
91
        $this->name = $name;
92
        return $this;
93
    }
94
95
    /**
96
     * Gets as type
97
     *
98
     * @return string
99
     */
100
    public function getType()
101
    {
102
        return $this->type;
103
    }
104
105
    /**
106
     * Sets a new type
107
     *
108
     * @param string $type
109
     * @return self
110
     */
111
    public function setType($type)
112
    {
113
        $this->type = $type;
114
        return $this;
115
    }
116
117
    /**
118
     * Gets as nullable
119
     *
120
     * @return boolean
121
     */
122
    public function getNullable()
123
    {
124
        return $this->nullable;
125
    }
126
127
    /**
128
     * Sets a new nullable
129
     *
130
     * @param boolean $nullable
131
     * @return self
132
     */
133
    public function setNullable($nullable)
134
    {
135
        $this->nullable = $nullable;
136
        return $this;
137
    }
138
139
    /**
140
     * Gets as defaultValue
141
     *
142
     * @return string
143
     */
144
    public function getDefaultValue()
145
    {
146
        return $this->defaultValue;
147
    }
148
149
    /**
150
     * Sets a new defaultValue
151
     *
152
     * @param string $defaultValue
153
     * @return self
154
     */
155
    public function setDefaultValue($defaultValue)
156
    {
157
        $this->defaultValue = $defaultValue;
158
        return $this;
159
    }
160
161
    /**
162
     * Gets as maxLength
163
     *
164
     * @return string
165
     */
166
    public function getMaxLength()
167
    {
168
        return $this->maxLength;
169
    }
170
171
    /**
172
     * Sets a new maxLength
173
     *
174
     * @param string $maxLength
175
     * @return self
176
     */
177
    public function setMaxLength($maxLength)
178
    {
179
        $this->maxLength = $maxLength;
180
        return $this;
181
    }
182
183
    /**
184
     * Gets as fixedLength
185
     *
186
     * @return boolean
187
     */
188
    public function getFixedLength()
189
    {
190
        return $this->fixedLength;
191
    }
192
193
    /**
194
     * Sets a new fixedLength
195
     *
196
     * @param boolean $fixedLength
197
     * @return self
198
     */
199
    public function setFixedLength($fixedLength)
200
    {
201
        $this->fixedLength = $fixedLength;
202
        return $this;
203
    }
204
205
    /**
206
     * Gets as precision
207
     *
208
     * @return integer
209
     */
210
    public function getPrecision()
211
    {
212
        return $this->precision;
213
    }
214
215
    /**
216
     * Sets a new precision
217
     *
218
     * @param integer $precision
219
     * @return self
220
     */
221
    public function setPrecision($precision)
222
    {
223
        $this->precision = $precision;
224
        return $this;
225
    }
226
227
    /**
228
     * Gets as scale
229
     *
230
     * @return integer
231
     */
232
    public function getScale()
233
    {
234
        return $this->scale;
235
    }
236
237
    /**
238
     * Sets a new scale
239
     *
240
     * @param integer $scale
241
     * @return self
242
     */
243
    public function setScale($scale)
244
    {
245
        $this->scale = $scale;
246
        return $this;
247
    }
248
249
    /**
250
     * Gets as unicode
251
     *
252
     * @return boolean
253
     */
254
    public function getUnicode()
255
    {
256
        return $this->unicode;
257
    }
258
259
    /**
260
     * Sets a new unicode
261
     *
262
     * @param boolean $unicode
263
     * @return self
264
     */
265
    public function setUnicode($unicode)
266
    {
267
        $this->unicode = $unicode;
268
        return $this;
269
    }
270
271
    /**
272
     * Gets as collation
273
     *
274
     * @return string
275
     */
276
    public function getCollation()
277
    {
278
        return $this->collation;
279
    }
280
281
    /**
282
     * Sets a new collation
283
     *
284
     * @param string $collation
285
     * @return self
286
     */
287
    public function setCollation($collation)
288
    {
289
        $this->collation = $collation;
290
        return $this;
291
    }
292
293
    /**
294
     * Gets as sRID
295
     *
296
     * @return string
297
     */
298
    public function getSRID()
299
    {
300
        return $this->sRID;
301
    }
302
303
    /**
304
     * Sets a new sRID
305
     *
306
     * @param string $sRID
307
     * @return self
308
     */
309
    public function setSRID($sRID)
310
    {
311
        $this->sRID = $sRID;
312
        return $this;
313
    }
314
315
    public function isOK(&$msg = null)
316
    {
317
        if (!$this->isStringNotNullOrEmpty($this->name)) {
318
            $msg = "Name cannot be null or empty";
319
            return false;
320
        }
321
        if (!$this->isStringNotNullOrEmpty($this->type)) {
322
            $msg = "Type cannot be null or empty";
323
            return false;
324
        }
325 View Code Duplication
        if (null != $this->defaultValue && !$this->isStringNotNullOrEmpty($this->defaultValue)) {
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...
326
            $msg = "Default value cannot be empty";
327
            return false;
328
        }
329 View Code Duplication
        if (null != $this->sRID && !$this->isStringNotNullOrEmpty($this->sRID)) {
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...
330
            $msg = "SRID value cannot be empty";
331
            return false;
332
        }
333 View Code Duplication
        if (null != $this->collation && !$this->isStringNotNullOrEmpty($this->collation)) {
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...
334
            $msg = "Collation value cannot be empty";
335
            return false;
336
        }
337 View Code Duplication
        if (null != $this->maxLength && !(is_numeric($this->maxLength) && 0 <= $this->maxLength)) {
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...
338
            $msg = "Max length must be numeric and non-negative";
339
            return false;
340
        }
341 View Code Duplication
        if (null != $this->precision && !(is_numeric($this->precision) && 0 <= $this->precision)) {
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...
342
            $msg = "Precision must be numeric and non-negative";
343
            return false;
344
        }
345 View Code Duplication
        if (null != $this->scale && !(is_numeric($this->scale) && 0 <= $this->scale)) {
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...
346
            $msg = "Scale must be numeric and non-negative";
347
            return false;
348
        }
349
        if (!$this->isTSimpleIdentifierValid($this->name)) {
350
            $msg = "Name must be valid TSimpleIdentifier";
351
            return false;
352
        }
353
        if (!$this->isTPropertyTypeValid($this->type)) {
354
            $msg = "Type must be valid TPropertyType";
355
            return false;
356
        }
357
        if (!$this->isExtensibilityElementOK($msg)) {
358
            return false;
359
        }
360
        return true;
361
    }
362
}
363