EntityBarcodeItem   B
last analyzed

Complexity

Total Complexity 50

Size/Duplication

Total Lines 525
Duplicated Lines 0 %

Test Coverage

Coverage 40.32%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 76
c 1
b 0
f 0
dl 0
loc 525
ccs 50
cts 124
cp 0.4032
rs 8.4
wmc 50

50 Methods

Rating   Name   Duplication   Size   Complexity  
A getBold() 0 3 1
A setAnchorPoint() 0 3 1
A setOrion() 0 3 1
A getProcessTilde() 0 3 1
A getAnchorPoint() 0 3 1
A setBarcodeType() 0 3 1
A getPointSize() 0 3 1
A setFrame() 0 3 1
A getFontName() 0 3 1
A getInverted() 0 3 1
A setData() 0 3 1
A setXPos() 0 3 1
A setPhantomField() 0 3 1
A setShowDropDowns() 0 3 1
A setSubType() 0 3 1
A setUseHibc() 0 3 1
A getHeight() 0 3 1
A setHeight() 0 3 1
A getShowDropDowns() 0 3 1
A getYPos() 0 3 1
A getSegmentWidth() 0 3 1
A setPreferredFormat() 0 3 1
A setBold() 0 3 1
A getSubType() 0 3 1
A getSeparatorHeight() 0 3 1
A getOrion() 0 3 1
A setInverted() 0 3 1
A setNarrow() 0 3 1
A getItalic() 0 3 1
A getHumanReadable() 0 3 1
A getXPos() 0 3 1
A getDescription() 0 3 1
A setPointSize() 0 3 1
A setProcessTilde() 0 3 1
A setDescription() 0 3 1
A setHumanReadable() 0 3 1
A getPhantomField() 0 3 1
A getBarcodeType() 0 3 1
A getData() 0 3 1
A getUseHibc() 0 3 1
A setRatio() 0 3 1
A setSeparatorHeight() 0 3 1
A setFontName() 0 3 1
A setSegmentWidth() 0 3 1
A setYPos() 0 3 1
A getPreferredFormat() 0 3 1
A setItalic() 0 3 1
A getRatio() 0 3 1
A getNarrow() 0 3 1
A getFrame() 0 3 1

How to fix   Complexity   

Complex Class

Complex classes like EntityBarcodeItem 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 EntityBarcodeItem, 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 EntityBarcodeItem 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 $height;
38
39
    /**
40
     * @var int
41
     */
42
    protected $orion;
43
44
    /**
45
     * @var string
46
     */
47
    protected $description;
48
49
    /**
50
     * @var int
51
     */
52
    protected $narrow;
53
54
    /**
55
     * @var int
56
     */
57
    protected $inverted;
58
59
    /**
60
     * @var int
61
     */
62
    protected $barcodeType;
63
64
    /**
65
     * @var string
66
     */
67
    protected $data;
68
69
    /**
70
     * @var int
71
     */
72
    protected $humanReadable;
73
74
    /**
75
     * @var int
76
     */
77
    protected $ratio;
78
79
    /**
80
     * @var int
81
     */
82
    protected $frame;
83
84
    /**
85
     * @var int
86
     */
87
    protected $showDropDowns;
88
89
    /**
90
     * @var string
91
     */
92
    protected $fontName;
93
94
    /**
95
     * @var int
96
     */
97
    protected $pointSize;
98
99
    /**
100
     * @var int
101
     */
102
    protected $bold;
103
104
    /**
105
     * @var int
106
     */
107
    protected $italic;
108
109
    /**
110
     * @var int
111
     */
112
    protected $subType;
113
114
    /**
115
     * @var int
116
     */
117
    protected $preferredFormat;
118
119
    /**
120
     * @var int
121
     */
122
    protected $processTilde;
123
124
    /**
125
     * @var int
126
     */
127
    protected $separatorHeight;
128
129
    /**
130
     * @var int
131
     */
132
    protected $segmentWidth;
133
134
    /**
135
     * @var int
136
     */
137
    protected $useHibc;
138
139
    /**
140
     * @var int
141
     */
142
    protected $phantomField;
143
144
    /**
145
     * @return int
146
     */
147 2
    public function getAnchorPoint()
148
    {
149 2
        return $this->anchorPoint;
150
    }
151
152
    /**
153
     * @param int $anchorPoint
154
     */
155
    public function setAnchorPoint($anchorPoint)
156
    {
157
        $this->anchorPoint = $anchorPoint;
158
    }
159
160
    /**
161
     * @return int
162
     */
163 2
    public function getXPos()
164
    {
165 2
        return $this->xPos;
166
    }
167
168
    /**
169
     * @param int $xPos
170
     */
171
    public function setXPos($xPos)
172
    {
173
        $this->xPos = $xPos;
174
    }
175
176
    /**
177
     * @return int
178
     */
179 2
    public function getYPos()
180
    {
181 2
        return $this->yPos;
182
    }
183
184
    /**
185
     * @param int $yPos
186
     */
187
    public function setYPos($yPos)
188
    {
189
        $this->yPos = $yPos;
190
    }
191
192
    /**
193
     * @return int
194
     */
195 2
    public function getHeight()
196
    {
197 2
        return $this->height;
198
    }
199
200
    /**
201
     * @param int $height
202
     */
203
    public function setHeight($height)
204
    {
205
        $this->height = $height;
206
    }
207
208
    /**
209
     * @return int
210
     */
211 2
    public function getOrion()
212
    {
213 2
        return $this->orion;
214
    }
215
216
    /**
217
     * @param int $orion
218
     */
219
    public function setOrion($orion)
220
    {
221
        $this->orion = $orion;
222
    }
223
224
    /**
225
     * @return string
226
     */
227 2
    public function getDescription()
228
    {
229 2
        return $this->description;
230
    }
231
232
    /**
233
     * @param string $description
234
     */
235
    public function setDescription($description)
236
    {
237
        $this->description = $description;
238
    }
239
240
    /**
241
     * @return int
242
     */
243 2
    public function getNarrow()
244
    {
245 2
        return $this->narrow;
246
    }
247
248
    /**
249
     * @param int $narrow
250
     */
251
    public function setNarrow($narrow)
252
    {
253
        $this->narrow = $narrow;
254
    }
255
256
    /**
257
     * @return int
258
     */
259 2
    public function getInverted()
260
    {
261 2
        return $this->inverted;
262
    }
263
264
    /**
265
     * @param int $inverted
266
     */
267
    public function setInverted($inverted)
268
    {
269
        $this->inverted = $inverted;
270
    }
271
272
    /**
273
     * @return int
274
     */
275 2
    public function getBarcodeType()
276
    {
277 2
        return $this->barcodeType;
278
    }
279
280
    /**
281
     * @param int $barcodeType
282
     */
283
    public function setBarcodeType($barcodeType)
284
    {
285
        $this->barcodeType = $barcodeType;
286
    }
287
288
    /**
289
     * @return string
290
     */
291 2
    public function getData()
292
    {
293 2
        return $this->data;
294
    }
295
296
    /**
297
     * @param string $data
298
     */
299
    public function setData($data)
300
    {
301
        $this->data = $data;
302
    }
303
304
    /**
305
     * @return int
306
     */
307 2
    public function getHumanReadable()
308
    {
309 2
        return $this->humanReadable;
310
    }
311
312
    /**
313
     * @param int $humanReadable
314
     */
315
    public function setHumanReadable($humanReadable)
316
    {
317
        $this->humanReadable = $humanReadable;
318
    }
319
320
    /**
321
     * @return int
322
     */
323 2
    public function getRatio()
324
    {
325 2
        return $this->ratio;
326
    }
327
328
    /**
329
     * @param int $ratio
330
     */
331
    public function setRatio($ratio)
332
    {
333
        $this->ratio = $ratio;
334
    }
335
336
    /**
337
     * @return int
338
     */
339 2
    public function getFrame()
340
    {
341 2
        return $this->frame;
342
    }
343
344
    /**
345
     * @param int $frame
346
     */
347
    public function setFrame($frame)
348
    {
349
        $this->frame = $frame;
350
    }
351
352
    /**
353
     * @return int
354
     */
355 2
    public function getShowDropDowns()
356
    {
357 2
        return $this->showDropDowns;
358
    }
359
360
    /**
361
     * @param int $showDropDowns
362
     */
363
    public function setShowDropDowns($showDropDowns)
364
    {
365
        $this->showDropDowns = $showDropDowns;
366
    }
367
368
    /**
369
     * @return string
370
     */
371 2
    public function getFontName()
372
    {
373 2
        return $this->fontName;
374
    }
375
376
    /**
377
     * @param string $fontName
378
     */
379
    public function setFontName($fontName)
380
    {
381
        $this->fontName = $fontName;
382
    }
383
384
    /**
385
     * @return int
386
     */
387 2
    public function getPointSize()
388
    {
389 2
        return $this->pointSize;
390
    }
391
392
    /**
393
     * @param int $pointSize
394
     */
395
    public function setPointSize($pointSize)
396
    {
397
        $this->pointSize = $pointSize;
398
    }
399
400
    /**
401
     * @return int
402
     */
403 2
    public function getBold()
404
    {
405 2
        return $this->bold;
406
    }
407
408
    /**
409
     * @param int $bold
410
     */
411
    public function setBold($bold)
412
    {
413
        $this->bold = $bold;
414
    }
415
416
    /**
417
     * @return int
418
     */
419 2
    public function getItalic()
420
    {
421 2
        return $this->italic;
422
    }
423
424
    /**
425
     * @param int $italic
426
     */
427
    public function setItalic($italic)
428
    {
429
        $this->italic = $italic;
430
    }
431
432
    /**
433
     * @return int
434
     */
435 2
    public function getSubType()
436
    {
437 2
        return $this->subType;
438
    }
439
440
    /**
441
     * @param int $subType
442
     */
443
    public function setSubType($subType)
444
    {
445
        $this->subType = $subType;
446
    }
447
448
    /**
449
     * @return int
450
     */
451 2
    public function getPreferredFormat()
452
    {
453 2
        return $this->preferredFormat;
454
    }
455
456
    /**
457
     * @param int $preferredFormat
458
     */
459
    public function setPreferredFormat($preferredFormat)
460
    {
461
        $this->preferredFormat = $preferredFormat;
462
    }
463
464
    /**
465
     * @return int
466
     */
467 2
    public function getProcessTilde()
468
    {
469 2
        return $this->processTilde;
470
    }
471
472
    /**
473
     * @param int $processTilde
474
     */
475
    public function setProcessTilde($processTilde)
476
    {
477
        $this->processTilde = $processTilde;
478
    }
479
480
    /**
481
     * @return int
482
     */
483 2
    public function getSeparatorHeight()
484
    {
485 2
        return $this->separatorHeight;
486
    }
487
488
    /**
489
     * @param int $separatorHeight
490
     */
491
    public function setSeparatorHeight($separatorHeight)
492
    {
493
        $this->separatorHeight = $separatorHeight;
494
    }
495
496
    /**
497
     * @return int
498
     */
499 2
    public function getSegmentWidth()
500
    {
501 2
        return $this->segmentWidth;
502
    }
503
504
    /**
505
     * @param int $segmentWidth
506
     */
507
    public function setSegmentWidth($segmentWidth)
508
    {
509
        $this->segmentWidth = $segmentWidth;
510
    }
511
512
    /**
513
     * @return int
514
     */
515 2
    public function getUseHibc()
516
    {
517 2
        return $this->useHibc;
518
    }
519
520
    /**
521
     * @param int $useHibc
522
     */
523
    public function setUseHibc($useHibc)
524
    {
525
        $this->useHibc = $useHibc;
526
    }
527
528
    /**
529
     * @return int
530
     */
531 2
    public function getPhantomField()
532
    {
533 2
        return $this->phantomField;
534
    }
535
536
    /**
537
     * @param int $phantomField
538
     */
539
    public function setPhantomField($phantomField)
540
    {
541
        $this->phantomField = $phantomField;
542
    }
543
}
544