Completed
Push — master ( d830a9...721bff )
by Christopher
39:46
created

TEntityPropertyType::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;
4
5
use AlgoWeb\ODataMetadata\Annotations\TGenerationPatternTrait;
6
use AlgoWeb\ODataMetadata\IsOK;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\TCommonPropertyAttributesTrait;
8
9
/**
10
 * Class representing TEntityPropertyType
11
 *
12
 *
13
 * XSD Type: TEntityProperty
14
 */
15
class TEntityPropertyType extends IsOK
16
{
17
    use TCommonPropertyAttributesTrait, TGenerationPatternTrait {
18
        TCommonPropertyAttributesTrait::normaliseString insteadof TGenerationPatternTrait;
19
        TCommonPropertyAttributesTrait::preserveString insteadof TGenerationPatternTrait;
20
        TCommonPropertyAttributesTrait::replaceString insteadof TGenerationPatternTrait;
21
        TCommonPropertyAttributesTrait::collapseString insteadof TGenerationPatternTrait;
22
        TCommonPropertyAttributesTrait::token insteadof TGenerationPatternTrait;
23
        TCommonPropertyAttributesTrait::string insteadof TGenerationPatternTrait;
24
        TCommonPropertyAttributesTrait::integer insteadof TGenerationPatternTrait;
25
        TCommonPropertyAttributesTrait::nonNegativeInteger insteadof TGenerationPatternTrait;
26
        TCommonPropertyAttributesTrait::decimal insteadof TGenerationPatternTrait;
27
        TCommonPropertyAttributesTrait::double insteadof TGenerationPatternTrait;
28
        TCommonPropertyAttributesTrait::dateTime insteadof TGenerationPatternTrait;
29
        TCommonPropertyAttributesTrait::hexBinary insteadof TGenerationPatternTrait;
30
    }
31
 
32
    /**
33
     * @property string $storeGeneratedPattern
34
     */
35
    private $storeGeneratedPattern = null;
36
37
    /**
38
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType[] $documentation
39
     */
40
    private $documentation = [];
41
42
    /**
43
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation
44
     */
45
    private $valueAnnotation = [];
46
47
    /**
48
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation
49
     */
50
    private $typeAnnotation = [];
51
52
    /**
53
     * Gets as storeGeneratedPattern
54
     *
55
     * @return string
56
     */
57
    public function getStoreGeneratedPattern()
58
    {
59
        return $this->storeGeneratedPattern;
60
    }
61
62
    /**
63
     * Sets a new storeGeneratedPattern
64
     *
65
     * @param string $storeGeneratedPattern
66
     * @return self
67
     */
68
    public function setStoreGeneratedPattern($storeGeneratedPattern)
69
    {
70
        $this->storeGeneratedPattern = $storeGeneratedPattern;
71
        return $this;
72
    }
73
74
    /**
75
     * Adds as documentation
76
     *
77
     * @return self
78
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation
79
     */
80
    public function addToDocumentation(TDocumentationType $documentation)
81
    {
82
        $this->documentation[] = $documentation;
83
        return $this;
84
    }
85
86
    /**
87
     * isset documentation
88
     *
89
     * @param scalar $index
90
     * @return boolean
91
     */
92
    public function issetDocumentation($index)
93
    {
94
        return isset($this->documentation[$index]);
95
    }
96
97
    /**
98
     * unset documentation
99
     *
100
     * @param scalar $index
101
     * @return void
102
     */
103
    public function unsetDocumentation($index)
104
    {
105
        unset($this->documentation[$index]);
106
    }
107
108
    /**
109
     * Gets as documentation
110
     *
111
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType[]
112
     */
113
    public function getDocumentation()
114
    {
115
        return $this->documentation;
116
    }
117
118
    /**
119
     * Sets a new documentation
120
     *
121
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType[] $documentation
122
     * @return self
123
     */
124
    public function setDocumentation(array $documentation)
125
    {
126
        $this->documentation = $documentation;
127
        return $this;
128
    }
129
130
    /**
131
     * Adds as valueAnnotation
132
     *
133
     * @return self
134
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType $valueAnnotation
135
     */
136
    public function addToValueAnnotation(TValueAnnotationType $valueAnnotation)
137
    {
138
        $this->valueAnnotation[] = $valueAnnotation;
139
        return $this;
140
    }
141
142
    /**
143
     * isset valueAnnotation
144
     *
145
     * @param scalar $index
146
     * @return boolean
147
     */
148
    public function issetValueAnnotation($index)
149
    {
150
        return isset($this->valueAnnotation[$index]);
151
    }
152
153
    /**
154
     * unset valueAnnotation
155
     *
156
     * @param scalar $index
157
     * @return void
158
     */
159
    public function unsetValueAnnotation($index)
160
    {
161
        unset($this->valueAnnotation[$index]);
162
    }
163
164
    /**
165
     * Gets as valueAnnotation
166
     *
167
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[]
168
     */
169
    public function getValueAnnotation()
170
    {
171
        return $this->valueAnnotation;
172
    }
173
174
    /**
175
     * Sets a new valueAnnotation
176
     *
177
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation
178
     * @return self
179
     */
180
    public function setValueAnnotation(array $valueAnnotation)
181
    {
182
        $this->valueAnnotation = $valueAnnotation;
183
        return $this;
184
    }
185
186
    /**
187
     * Adds as typeAnnotation
188
     *
189
     * @return self
190
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType $typeAnnotation
191
     */
192
    public function addToTypeAnnotation(TTypeAnnotationType $typeAnnotation)
193
    {
194
        $this->typeAnnotation[] = $typeAnnotation;
195
        return $this;
196
    }
197
198
    /**
199
     * isset typeAnnotation
200
     *
201
     * @param scalar $index
202
     * @return boolean
203
     */
204
    public function issetTypeAnnotation($index)
205
    {
206
        return isset($this->typeAnnotation[$index]);
207
    }
208
209
    /**
210
     * unset typeAnnotation
211
     *
212
     * @param scalar $index
213
     * @return void
214
     */
215
    public function unsetTypeAnnotation($index)
216
    {
217
        unset($this->typeAnnotation[$index]);
218
    }
219
220
    /**
221
     * Gets as typeAnnotation
222
     *
223
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[]
224
     */
225
    public function getTypeAnnotation()
226
    {
227
        return $this->typeAnnotation;
228
    }
229
230
    /**
231
     * Sets a new typeAnnotation
232
     *
233
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation
234
     * @return self
235
     */
236
    public function setTypeAnnotation(array $typeAnnotation)
237
    {
238
        $this->typeAnnotation = $typeAnnotation;
239
        return $this;
240
    }
241
242
    public function isOK(&$msg = null)
243
    {
244
        if (null != $this->storeGeneratedPattern && !$this->isTGenerationPatternValid($this->storeGeneratedPattern)) {
245
            $msg = "Store generation pattern must be a valid TGenerationPattern: " . get_class($this);
246
            return false;
247
        }
248
        if (!$this->isValidArrayOK(
249
            $this->documentation,
250
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType',
251
            $msg,
252
            0,
253
            1
254
        )) {
255
            return false;
256
        }
257
        if (!$this->isValidArrayOK(
258
            $this->valueAnnotation,
259
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType',
260
            $msg
261
        )) {
262
            return false;
263
        }
264
        if (!$this->isValidArrayOK(
265
            $this->typeAnnotation,
266
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType',
267
            $msg
268
        )) {
269
            return false;
270
        }
271
272
        if (!$this->isTCommonPropertyAttributesValid($msg)) {
273
            return false;
274
        }
275
        return true;
276
    }
277
}
278