Passed
Push — master ( feaee9...2b3e4e )
by Alex
04:28
created

TFunctionImportAttributesTrait::setIsBindable()   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\Groups;
4
5
use AlgoWeb\ODataMetadata\CodeGeneration\AccessTypeTraits;
6
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionImportReturnTypeType;
9
use AlgoWeb\ODataMetadata\MetadataV3\edm\TOperandType;
10
11
trait TFunctionImportAttributesTrait
12
{
13
    use TSimpleIdentifierTrait, AccessTypeTraits, IsOKToolboxTrait;
14
    
15
    /**
16
     * @property string $name
17
     */
18
    private $name = null;
19
20
    /**
21
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionImportReturnTypeType[] $returnType
22
     */
23
    private $returnType = [];
24
25
    /**
26
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TOperandType $entitySet
27
     */
28
    private $entitySet = null;
29
30
    /**
31
     * @property boolean $isComposable
32
     */
33
    private $isComposable = false;
34
35
    /**
36
     * @property boolean $isSideEffecting
37
     */
38
    private $isSideEffecting = false;
39
40
    /**
41
     * @property boolean $isBindable
42
     */
43
    private $isBindable = false;
44
45
    /**
46
     * @property string $methodAccess
47
     */
48
    private $methodAccess = null;
49
50
    /**
51
     * Gets as name
52
     *
53
     * @return string
54
     */
55
    public function getName()
56
    {
57
        return $this->name;
58
    }
59
60
    /**
61
     * Sets a new name
62
     *
63
     * @param string $name
64
     * @return self
65
     */
66
    public function setName($name)
67
    {
68
        $this->name = $name;
69
        return $this;
70
    }
71
72
    /**
73
     * Adds as returnType
74
     *
75
     * @return self
76
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionImportReturnTypeType $returnType
77
     */
78
    public function addToReturnType(TFunctionImportReturnTypeType $returnType)
79
    {
80
        $this->returnType[] = $returnType;
81
        return $this;
82
    }
83
84
    /**
85
     * isset returnType
86
     *
87
     * @param scalar $index
88
     * @return boolean
89
     */
90
    public function issetReturnType($index)
91
    {
92
        return isset($this->returnType[$index]);
93
    }
94
95
    /**
96
     * unset returnType
97
     *
98
     * @param scalar $index
99
     * @return void
100
     */
101
    public function unsetReturnType($index)
102
    {
103
        unset($this->returnType[$index]);
104
    }
105
106
    /**
107
     * Gets as returnType
108
     *
109
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionImportReturnTypeType[]
110
     */
111
    public function getReturnType()
112
    {
113
        return $this->returnType;
114
    }
115
116
    /**
117
     * Sets a new returnType
118
     *
119
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionImportReturnTypeType[] $returnType
120
     * @return self
121
     */
122
    public function setReturnType(array $returnType)
123
    {
124
        $this->returnType = $returnType;
125
        return $this;
126
    }
127
128
    /**
129
     * Gets as entitySet
130
     *
131
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TOperandType
132
     */
133
    public function getEntitySet()
134
    {
135
        return $this->entitySet;
136
    }
137
138
    /**
139
     * Sets a new entitySet
140
     *
141
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TOperandType $entitySet
142
     * @return self
143
     */
144
    public function setEntitySet(TOperandType $entitySet)
145
    {
146
        $this->entitySet = $entitySet;
147
        return $this;
148
    }
149
150
    /**
151
     * Gets as isComposable
152
     *
153
     * @return boolean
154
     */
155
    public function getIsComposable()
156
    {
157
        return $this->isComposable;
158
    }
159
160
    /**
161
     * Sets a new isComposable
162
     *
163
     * @param boolean $isComposable
164
     * @return self
165
     */
166
    public function setIsComposable($isComposable)
167
    {
168
        $this->isComposable = boolval($isComposable);
169
        return $this;
170
    }
171
172
    /**
173
     * Gets as isSideEffecting
174
     *
175
     * @return boolean
176
     */
177
    public function getIsSideEffecting()
178
    {
179
        return $this->isSideEffecting;
180
    }
181
182
    /**
183
     * Sets a new isSideEffecting
184
     *
185
     * @param boolean $isSideEffecting
186
     * @return self
187
     */
188
    public function setIsSideEffecting($isSideEffecting)
189
    {
190
        $this->isSideEffecting = boolval($isSideEffecting);
191
        return $this;
192
    }
193
194
    /**
195
     * Gets as isBindable
196
     *
197
     * @return boolean
198
     */
199
    public function getIsBindable()
200
    {
201
        return $this->isBindable;
202
    }
203
204
    /**
205
     * Sets a new isBindable
206
     *
207
     * @param boolean $isBindable
208
     * @return self
209
     */
210
    public function setIsBindable($isBindable)
211
    {
212
        $this->isBindable = boolval($isBindable);
213
        return $this;
214
    }
215
216
    /**
217
     * Gets as methodAccess
218
     *
219
     * @return string
220
     */
221
    public function getMethodAccess()
222
    {
223
        return $this->methodAccess;
224
    }
225
226
    /**
227
     * Sets a new methodAccess
228
     *
229
     * @param string $methodAccess
230
     * @return self
231
     */
232
    public function setMethodAccess($methodAccess)
233
    {
234
        $this->methodAccess = $methodAccess;
235
        return $this;
236
    }
237
    
238
    
239
    public function isTFunctionImportAttributesValid(&$msg)
240
    {
241
        if (!$this->isTSimpleIdentifierValid($this->name)) {
242
            $msg = "Name must be a valid TSimpleIdentifier";
243
            return false;
244
        }
245
        /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
57% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
246
        if (null != $this->entitySet && !$this->isTSimpleIdentifierValid($this->entitySet)) {
247
            $msg = "Entity set must be a valid TSimpleIdentifier";
248
            return false;
249
        }*/
250
        if (!$this->isObjectNullOrType('\AlgoWeb\ODataMetadata\MetadataV3\edm\TOperandType', $this->entitySet)) {
251
            $msg = "Entity set must be either null or an instance of TOperandType";
252
            return false;
253
        }
254
        if (null != $this->methodAccess && $this->isTAccessOk($this->methodAccess)) {
255
            $msg = "Method access must be a valid TAccess";
256
            return false;
257
        }
258
        if (!$this->isValidArrayOK(
259
            $this->returnType,
260
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionImportReturnTypeType',
261
            $msg
262
        )) {
263
            return false;
264
        }
265
        
266
        return true;
267
    }
268
}
269