Test Failed
Push — master ( 0f618b...fb6850 )
by Alex
09:40
created

TParameterType::getType()   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\edm\ssdl;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TParameterModeTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TFunctionTypeTrait;
8
9
/**
10
 * Class representing TParameterType
11
 *
12
 *
13
 * XSD Type: TParameter
14
 */
15
class TParameterType extends IsOK
16
{
17
    use TParameterModeTrait, TFunctionTypeTrait;
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 string $mode
30
     */
31
    private $mode = null;
32
33
    /**
34
     * @property string $maxLength
35
     */
36
    private $maxLength = null;
37
38
    /**
39
     * @property integer $precision
40
     */
41
    private $precision = null;
42
43
    /**
44
     * @property integer $scale
45
     */
46
    private $scale = null;
47
48
    /**
49
     * @property string $sRID
50
     */
51
    private $sRID = null;
52
53
    /**
54
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation
55
     */
56
    private $documentation = null;
57
58
    /**
59
     * Gets as name
60
     *
61
     * @return string
62
     */
63
    public function getName()
64
    {
65
        return $this->name;
66
    }
67
68
    /**
69
     * Sets a new name
70
     *
71
     * @param string $name
72
     * @return self
73
     */
74 View Code Duplication
    public function setName($name)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
75
    {
76
        $msg = null;
0 ignored issues
show
Unused Code introduced by
$msg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
77
        if (!$this->isStringNotNullOrEmpty($name)) {
78
            $msg = "Name cannot be null or empty";
79
            throw new \InvalidArgumentException($msg);
80
        }
81
        $this->name = $name;
82
        return $this;
83
    }
84
85
    /**
86
     * Gets as type
87
     *
88
     * @return string
89
     */
90
    public function getType()
91
    {
92
        return $this->type;
93
    }
94
95
    /**
96
     * Sets a new type
97
     *
98
     * @param string $type
99
     * @return self
100
     */
101 View Code Duplication
    public function setType($type)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
102
    {
103
        $msg = null;
0 ignored issues
show
Unused Code introduced by
$msg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
104
        if (!$this->isStringNotNullOrEmpty($type)) {
105
            $msg = "Type cannot be null or empty";
106
            throw new \InvalidArgumentException($msg);
107
        }
108
        if (null != $type && !$this->isTFunctionTypeValid($type)) {
109
            $msg = "Type must be a valid TFunctionType";
110
            throw new \InvalidArgumentException($msg);
111
        }
112
        $this->type = $type;
113
        return $this;
114
    }
115
116
    /**
117
     * Gets as mode
118
     *
119
     * @return string
120
     */
121
    public function getMode()
122
    {
123
        return $this->mode;
124
    }
125
126
    /**
127
     * Sets a new mode
128
     *
129
     * @param string $mode
130
     * @return self
131
     */
132
    public function setMode($mode)
133
    {
134
        $msg = null;
0 ignored issues
show
Unused Code introduced by
$msg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
135
        if (null != $mode && !$this->isStringNotNullOrEmpty($mode)) {
136
            $msg = "Mode cannot be empty";
137
            throw new \InvalidArgumentException($msg);
138
        }
139
        if (null != $mode && !$this->isTParameterModeValid($mode)) {
140
            $msg = "Mode must be a valid TParameterMode";
141
            throw new \InvalidArgumentException($msg);
142
        }
143
        $this->mode = $mode;
144
        return $this;
145
    }
146
147
    /**
148
     * Gets as maxLength
149
     *
150
     * @return string
151
     */
152
    public function getMaxLength()
153
    {
154
        return $this->maxLength;
155
    }
156
157
    /**
158
     * Sets a new maxLength
159
     *
160
     * @param string $maxLength
161
     * @return self
162
     */
163
    public function setMaxLength($maxLength)
164
    {
165
        $this->maxLength = $maxLength;
166
        return $this;
167
    }
168
169
    /**
170
     * Gets as precision
171
     *
172
     * @return integer
173
     */
174
    public function getPrecision()
175
    {
176
        return $this->precision;
177
    }
178
179
    /**
180
     * Sets a new precision
181
     *
182
     * @param integer $precision
183
     * @return self
184
     */
185
    public function setPrecision($precision)
186
    {
187
        $this->precision = $precision;
188
        return $this;
189
    }
190
191
    /**
192
     * Gets as scale
193
     *
194
     * @return integer
195
     */
196
    public function getScale()
197
    {
198
        return $this->scale;
199
    }
200
201
    /**
202
     * Sets a new scale
203
     *
204
     * @param integer $scale
205
     * @return self
206
     */
207
    public function setScale($scale)
208
    {
209
        $this->scale = $scale;
210
        return $this;
211
    }
212
213
    /**
214
     * Gets as sRID
215
     *
216
     * @return string
217
     */
218
    public function getSRID()
219
    {
220
        return $this->sRID;
221
    }
222
223
    /**
224
     * Sets a new sRID
225
     *
226
     * @param string $sRID
227
     * @return self
228
     */
229 View Code Duplication
    public function setSRID($sRID)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
230
    {
231
        $msg = null;
0 ignored issues
show
Unused Code introduced by
$msg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
232
        if (null != $sRID && !$this->isStringNotNullOrEmpty($sRID)) {
233
            $msg = "SRID cannot be empty";
234
            throw new \InvalidArgumentException($msg);
235
        }
236
        $this->sRID = $sRID;
237
        return $this;
238
    }
239
240
    /**
241
     * Gets as documentation
242
     *
243
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType
244
     */
245
    public function getDocumentation()
246
    {
247
        return $this->documentation;
248
    }
249
250
    /**
251
     * Sets a new documentation
252
     *
253
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation
254
     * @return self
255
     */
256 View Code Duplication
    public function setDocumentation(TDocumentationType $documentation)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
257
    {
258
        $msg = null;
259
        if (!$documentation->isOK($msg)) {
260
            throw new \InvalidArgumentException($msg);
261
        }
262
        $this->documentation = $documentation;
263
        return $this;
264
    }
265
266
    public function isOK(&$msg = null)
267
    {
268
        if (!$this->isStringNotNullOrEmpty($this->name)) {
269
            $msg = "Name cannot be null or empty";
270
            return false;
271
        }
272
        if (!$this->isStringNotNullOrEmpty($this->type)) {
273
            $msg = "Type cannot be null or empty";
274
            return false;
275
        }
276 View Code Duplication
        if (null != $this->mode && !$this->isStringNotNullOrEmpty($this->mode)) {
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...
277
            $msg = "Mode cannot be empty";
278
            return false;
279
        }
280 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...
281
            $msg = "SRID cannot be empty";
282
            return false;
283
        }
284
        if (null != $this->type && !$this->isTFunctionTypeValid($this->type)) {
285
            $msg = "Type must be a valid TFunctionType";
286
            return false;
287
        }
288 View Code Duplication
        if (null != $this->mode && !$this->isTParameterModeValid($this->mode)) {
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...
289
            $msg = "Mode must be a valid TParameterMode";
290
            return false;
291
        }
292
293
        return true;
294
    }
295
}
296