EntityTtfItem   A
last analyzed

Complexity

Total Complexity 42

Size/Duplication

Total Lines 441
Duplicated Lines 0 %

Test Coverage

Coverage 40.38%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 64
c 1
b 0
f 0
dl 0
loc 441
ccs 42
cts 104
cp 0.4038
rs 9.0399
wmc 42

42 Methods

Rating   Name   Duplication   Size   Complexity  
A setData() 0 3 1
A getWidth() 0 3 1
A setFontName() 0 3 1
A setAnchorPoint() 0 3 1
A setLineSpacing() 0 3 1
A getDescription() 0 3 1
A setDescription() 0 3 1
A setFontWidth() 0 3 1
A getOrion() 0 3 1
A setFontSize() 0 3 1
A getRemoveBlank() 0 3 1
A getFontName() 0 3 1
A getCharSpacing() 0 3 1
A setFtbMode() 0 3 1
A setRemoveBlank() 0 3 1
A getData() 0 3 1
A setOrion() 0 3 1
A setPhantomField() 0 3 1
A setCharSpacing() 0 3 1
A getFontSize() 0 3 1
A setFontBold() 0 3 1
A setAlignment() 0 3 1
A getAnchorPoint() 0 3 1
A setFontUnderline() 0 3 1
A getLineSpacing() 0 3 1
A getFontUnderline() 0 3 1
A getFtbMode() 0 3 1
A getHeight() 0 3 1
A getAlignment() 0 3 1
A setXPos() 0 3 1
A getPhantomField() 0 3 1
A getFontBold() 0 3 1
A getFontItalic() 0 3 1
A getXPos() 0 3 1
A getInverted() 0 3 1
A setYPos() 0 3 1
A setWidth() 0 3 1
A setInverted() 0 3 1
A getFontWidth() 0 3 1
A setFontItalic() 0 3 1
A getYPos() 0 3 1
A setHeight() 0 3 1

How to fix   Complexity   

Complex Class

Complex classes like EntityTtfItem often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use EntityTtfItem, and based on these observations, apply Extract Interface, too.

1
<?php
2
/**
3
 * This file is part of graze/unicontroller-client.
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/unicontroller-client/blob/master/LICENSE.md
11
 * @link https://github.com/graze/unicontroller-client
12
 */
13
namespace Graze\UnicontrollerClient\Entity\Entity;
14
15
use Graze\UnicontrollerClient\Entity\Entity\EntityInterface;
16
17
class EntityTtfItem implements EntityInterface
18
{
19
    /**
20
     * @var int
21
     */
22
    protected $anchorPoint;
23
24
    /**
25
     * @var int
26
     */
27
    protected $xPos;
28
29
    /**
30
     * @var int
31
     */
32
    protected $yPos;
33
34
    /**
35
     * @var int
36
     */
37
    protected $width;
38
39
    /**
40
     * @var int
41
     */
42
    protected $height;
43
44
    /**
45
     * @var int
46
     */
47
    protected $orion;
48
49
    /**
50
     * @var string
51
     */
52
    protected $description;
53
54
    /**
55
     * @var string
56
     */
57
    protected $fontName;
58
59
    /**
60
     * @var int
61
     */
62
    protected $fontSize;
63
64
    /**
65
     * @var int
66
     */
67
    protected $fontBold;
68
69
    /**
70
     * @var int
71
     */
72
    protected $fontItalic;
73
74
    /**
75
     * @var int
76
     */
77
    protected $fontUnderline;
78
79
    /**
80
     * @var int
81
     */
82
    protected $inverted;
83
84
    /**
85
     * @var int
86
     */
87
    protected $alignment;
88
89
    /**
90
     * @var string
91
     */
92
    protected $data;
93
94
    /**
95
     * @var int
96
     */
97
    protected $ftbMode;
98
99
    /**
100
     * @var int
101
     */
102
    protected $lineSpacing;
103
104
    /**
105
     * @var int
106
     */
107
    protected $removeBlank;
108
109
    /**
110
     * @var int
111
     */
112
    protected $fontWidth;
113
114
    /**
115
     * @var int
116
     */
117
    protected $charSpacing;
118
119
    /**
120
     * @var int
121
     */
122
    protected $phantomField;
123
124
    /**
125
     * @return int
126
     */
127 2
    public function getAnchorPoint()
128
    {
129 2
        return $this->anchorPoint;
130
    }
131
132
    /**
133
     * @param int $anchorPoint
134
     */
135
    public function setAnchorPoint($anchorPoint)
136
    {
137
        $this->anchorPoint = $anchorPoint;
138
    }
139
140
    /**
141
     * @return int
142
     */
143 2
    public function getXPos()
144
    {
145 2
        return $this->xPos;
146
    }
147
148
    /**
149
     * @param int $xPos
150
     */
151
    public function setXPos($xPos)
152
    {
153
        $this->xPos = $xPos;
154
    }
155
156
    /**
157
     * @return int
158
     */
159 2
    public function getYPos()
160
    {
161 2
        return $this->yPos;
162
    }
163
164
    /**
165
     * @param int $yPos
166
     */
167
    public function setYPos($yPos)
168
    {
169
        $this->yPos = $yPos;
170
    }
171
172
    /**
173
     * @return int
174
     */
175 2
    public function getWidth()
176
    {
177 2
        return $this->width;
178
    }
179
180
    /**
181
     * @param int $width
182
     */
183
    public function setWidth($width)
184
    {
185
        $this->width = $width;
186
    }
187
188
    /**
189
     * @return int
190
     */
191 2
    public function getHeight()
192
    {
193 2
        return $this->height;
194
    }
195
196
    /**
197
     * @param int $height
198
     */
199
    public function setHeight($height)
200
    {
201
        $this->height = $height;
202
    }
203
204
    /**
205
     * @return int
206
     */
207 2
    public function getOrion()
208
    {
209 2
        return $this->orion;
210
    }
211
212
    /**
213
     * @param int $orion
214
     */
215
    public function setOrion($orion)
216
    {
217
        $this->orion = $orion;
218
    }
219
220
    /**
221
     * @return string
222
     */
223 2
    public function getDescription()
224
    {
225 2
        return $this->description;
226
    }
227
228
    /**
229
     * @param string $description
230
     */
231
    public function setDescription($description)
232
    {
233
        $this->description = $description;
234
    }
235
236
    /**
237
     * @return string
238
     */
239 2
    public function getFontName()
240
    {
241 2
        return $this->fontName;
242
    }
243
244
    /**
245
     * @param string $fontName
246
     */
247
    public function setFontName($fontName)
248
    {
249
        $this->fontName = $fontName;
250
    }
251
252
    /**
253
     * @return int
254
     */
255 2
    public function getFontSize()
256
    {
257 2
        return $this->fontSize;
258
    }
259
260
    /**
261
     * @param int $fontSize
262
     */
263
    public function setFontSize($fontSize)
264
    {
265
        $this->fontSize = $fontSize;
266
    }
267
268
    /**
269
     * @return int
270
     */
271 2
    public function getFontBold()
272
    {
273 2
        return $this->fontBold;
274
    }
275
276
    /**
277
     * @param int $fontBold
278
     */
279
    public function setFontBold($fontBold)
280
    {
281
        $this->fontBold = $fontBold;
282
    }
283
284
    /**
285
     * @return int
286
     */
287 2
    public function getFontItalic()
288
    {
289 2
        return $this->fontItalic;
290
    }
291
292
    /**
293
     * @param int $fontItalic
294
     */
295
    public function setFontItalic($fontItalic)
296
    {
297
        $this->fontItalic = $fontItalic;
298
    }
299
300
    /**
301
     * @return int
302
     */
303 2
    public function getFontUnderline()
304
    {
305 2
        return $this->fontUnderline;
306
    }
307
308
    /**
309
     * @param int $fontUnderline
310
     */
311
    public function setFontUnderline($fontUnderline)
312
    {
313
        $this->fontUnderline = $fontUnderline;
314
    }
315
316
    /**
317
     * @return int
318
     */
319 2
    public function getInverted()
320
    {
321 2
        return $this->inverted;
322
    }
323
324
    /**
325
     * @param int $inverted
326
     */
327
    public function setInverted($inverted)
328
    {
329
        $this->inverted = $inverted;
330
    }
331
332
    /**
333
     * @return int
334
     */
335 2
    public function getAlignment()
336
    {
337 2
        return $this->alignment;
338
    }
339
340
    /**
341
     * @param int $alignment
342
     */
343
    public function setAlignment($alignment)
344
    {
345
        $this->alignment = $alignment;
346
    }
347
348
    /**
349
     * @return string
350
     */
351 2
    public function getData()
352
    {
353 2
        return $this->data;
354
    }
355
356
    /**
357
     * @param string $data
358
     */
359
    public function setData($data)
360
    {
361
        $this->data = $data;
362
    }
363
364
    /**
365
     * @return int
366
     */
367 2
    public function getFtbMode()
368
    {
369 2
        return $this->ftbMode;
370
    }
371
372
    /**
373
     * @param int $ftbMode
374
     */
375
    public function setFtbMode($ftbMode)
376
    {
377
        $this->ftbMode = $ftbMode;
378
    }
379
380
    /**
381
     * @return int
382
     */
383 2
    public function getLineSpacing()
384
    {
385 2
        return $this->lineSpacing;
386
    }
387
388
    /**
389
     * @param int $lineSpacing
390
     */
391
    public function setLineSpacing($lineSpacing)
392
    {
393
        $this->lineSpacing = $lineSpacing;
394
    }
395
396
    /**
397
     * @return int
398
     */
399 2
    public function getRemoveBlank()
400
    {
401 2
        return $this->removeBlank;
402
    }
403
404
    /**
405
     * @param int $removeBlank
406
     */
407
    public function setRemoveBlank($removeBlank)
408
    {
409
        $this->removeBlank = $removeBlank;
410
    }
411
412
    /**
413
     * @return int
414
     */
415 2
    public function getFontWidth()
416
    {
417 2
        return $this->fontWidth;
418
    }
419
420
    /**
421
     * @param int $fontWidth
422
     */
423
    public function setFontWidth($fontWidth)
424
    {
425
        $this->fontWidth = $fontWidth;
426
    }
427
428
    /**
429
     * @return int
430
     */
431 2
    public function getCharSpacing()
432
    {
433 2
        return $this->charSpacing;
434
    }
435
436
    /**
437
     * @param int $charSpacing
438
     */
439
    public function setCharSpacing($charSpacing)
440
    {
441
        $this->charSpacing = $charSpacing;
442
    }
443
444
    /**
445
     * @return int
446
     */
447 2
    public function getPhantomField()
448
    {
449 2
        return $this->phantomField;
450
    }
451
452
    /**
453
     * @param int $phantomField
454
     */
455
    public function setPhantomField($phantomField)
456
    {
457
        $this->phantomField = $phantomField;
458
    }
459
}
460