Passed
Push — master ( 418524...2ac80a )
by Alex
03:43
created

TEntityTypeShapeType   A

Complexity

Total Complexity 28

Size/Duplication

Total Lines 227
Duplicated Lines 3.52 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 28
lcom 1
cbo 1
dl 8
loc 227
rs 10
c 1
b 0
f 0

15 Methods

Rating   Name   Duplication   Size   Complexity  
A getEntityType() 0 4 1
A setEntityType() 0 5 1
A getPointX() 0 4 1
A setPointX() 0 5 1
A getPointY() 0 4 1
A setPointY() 0 5 1
A getWidth() 0 4 1
A setWidth() 0 5 1
A getHeight() 0 4 1
A setHeight() 0 5 1
A getIsExpanded() 0 4 1
A setIsExpanded() 0 5 1
A getFillColor() 0 4 1
A setFillColor() 0 5 1
C isOK() 8 31 14

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edmx;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
7
/**
8
 * Class representing TEntityTypeShapeType
9
 *
10
 *
11
 * XSD Type: TEntityTypeShape
12
 */
13
class TEntityTypeShapeType extends IsOK
14
{
15
16
    /**
17
     * @property string $entityType
18
     */
19
    private $entityType = null;
20
21
    /**
22
     * @property float $pointX
23
     */
24
    private $pointX = null;
25
26
    /**
27
     * @property float $pointY
28
     */
29
    private $pointY = null;
30
31
    /**
32
     * @property float $width
33
     */
34
    private $width = null;
35
36
    /**
37
     * @property float $height
38
     */
39
    private $height = null;
40
41
    /**
42
     * @property boolean $isExpanded
43
     */
44
    private $isExpanded = null;
45
46
    /**
47
     * @property string $fillColor
48
     */
49
    private $fillColor = null;
50
51
    /**
52
     * Gets as entityType
53
     *
54
     * @return string
55
     */
56
    public function getEntityType()
57
    {
58
        return $this->entityType;
59
    }
60
61
    /**
62
     * Sets a new entityType
63
     *
64
     * @param string $entityType
65
     * @return self
66
     */
67
    public function setEntityType($entityType)
68
    {
69
        $this->entityType = $entityType;
70
        return $this;
71
    }
72
73
    /**
74
     * Gets as pointX
75
     *
76
     * @return float
77
     */
78
    public function getPointX()
79
    {
80
        return $this->pointX;
81
    }
82
83
    /**
84
     * Sets a new pointX
85
     *
86
     * @param float $pointX
87
     * @return self
88
     */
89
    public function setPointX($pointX)
90
    {
91
        $this->pointX = $pointX;
92
        return $this;
93
    }
94
95
    /**
96
     * Gets as pointY
97
     *
98
     * @return float
99
     */
100
    public function getPointY()
101
    {
102
        return $this->pointY;
103
    }
104
105
    /**
106
     * Sets a new pointY
107
     *
108
     * @param float $pointY
109
     * @return self
110
     */
111
    public function setPointY($pointY)
112
    {
113
        $this->pointY = $pointY;
114
        return $this;
115
    }
116
117
    /**
118
     * Gets as width
119
     *
120
     * @return float
121
     */
122
    public function getWidth()
123
    {
124
        return $this->width;
125
    }
126
127
    /**
128
     * Sets a new width
129
     *
130
     * @param float $width
131
     * @return self
132
     */
133
    public function setWidth($width)
134
    {
135
        $this->width = $width;
136
        return $this;
137
    }
138
139
    /**
140
     * Gets as height
141
     *
142
     * @return float
143
     */
144
    public function getHeight()
145
    {
146
        return $this->height;
147
    }
148
149
    /**
150
     * Sets a new height
151
     *
152
     * @param float $height
153
     * @return self
154
     */
155
    public function setHeight($height)
156
    {
157
        $this->height = $height;
158
        return $this;
159
    }
160
161
    /**
162
     * Gets as isExpanded
163
     *
164
     * @return boolean
165
     */
166
    public function getIsExpanded()
167
    {
168
        return $this->isExpanded;
169
    }
170
171
    /**
172
     * Sets a new isExpanded
173
     *
174
     * @param boolean $isExpanded
175
     * @return self
176
     */
177
    public function setIsExpanded($isExpanded)
178
    {
179
        $this->isExpanded = $isExpanded;
180
        return $this;
181
    }
182
183
    /**
184
     * Gets as fillColor
185
     *
186
     * @return string
187
     */
188
    public function getFillColor()
189
    {
190
        return $this->fillColor;
191
    }
192
193
    /**
194
     * Sets a new fillColor
195
     *
196
     * @param string $fillColor
197
     * @return self
198
     */
199
    public function setFillColor($fillColor)
200
    {
201
        $this->fillColor = $fillColor;
202
        return $this;
203
    }
204
205
    /**
206
     * @return bool
207
     */
208
    public function isOK(&$msg = null)
209
    {
210
        if (!$this->isStringNotNullOrEmpty($this->entityType)) {
211
            $msg = "Entity type cannot be null or empty";
212
            return false;
213
        }
214
215
        if (null != $this->fillColor && !$this->isStringNotNullOrEmpty($this->fillColor)) {
216
            $msg = "Entity type cannot be null or empty";
217
            return false;
218
        }
219
220 View Code Duplication
        if (null != $this->pointX && !is_numeric($this->pointX)) {
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...
221
            $msg = "Point X value must be numeric";
222
            return false;
223
        }
224 View Code Duplication
        if (null != $this->pointY && !is_numeric($this->pointY)) {
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...
225
            $msg = "Point Y value must be numeric";
226
            return false;
227
        }
228
        if (null != $this->width && (!is_numeric($this->width) || 0 >= $this->width)) {
229
            $msg = "Width value must be numeric and positive";
230
            return false;
231
        }
232
        if (null != $this->height && (!is_numeric($this->height) || 0 >= $this->height)) {
233
            $msg = "Height value must be numeric and positive";
234
            return false;
235
        }
236
237
        return true;
238
    }
239
}
240