Completed
Push — master ( 5f68f7...766e2f )
by Alexander
01:24
created

Slice   F

Complexity

Total Complexity 74

Size/Duplication

Total Lines 742
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 74
lcom 0
cbo 1
dl 0
loc 742
rs 2.338
c 0
b 0
f 0

74 Methods

Rating   Name   Duplication   Size   Complexity  
A getAfter() 0 4 1
A setAfter() 0 5 1
A getBlockIOAccounting() 0 4 1
A setBlockIOAccounting() 0 5 1
A getBlockIOWeight() 0 4 1
A setBlockIOWeight() 0 5 1
A getCPUAccounting() 0 4 1
A setCPUAccounting() 0 5 1
A getCPUQuotaPerSecUSec() 0 4 1
A setCPUQuotaPerSecUSec() 0 5 1
A getCPUShares() 0 4 1
A setCPUShares() 0 5 1
A getCPUUsageNSec() 0 4 1
A setCPUUsageNSec() 0 5 1
A getCPUWeight() 0 4 1
A setCPUWeight() 0 5 1
A getConflicts() 0 4 1
A setConflicts() 0 5 1
A getControlGroup() 0 4 1
A setControlGroup() 0 5 1
A getDelegate() 0 4 1
A setDelegate() 0 5 1
A getDevicePolicy() 0 4 1
A setDevicePolicy() 0 5 1
A getDropInPaths() 0 4 1
A setDropInPaths() 0 5 1
A getDocumentation() 0 4 1
A setDocumentation() 0 5 1
A getFragmentPath() 0 4 1
A setFragmentPath() 0 5 1
A getIOAccounting() 0 4 1
A setIOAccounting() 0 5 1
A getIOWeight() 0 4 1
A setIOWeight() 0 5 1
A getMemoryAccounting() 0 4 1
A setMemoryAccounting() 0 5 1
A getMemoryCurrent() 0 4 1
A setMemoryCurrent() 0 5 1
A getMemoryHigh() 0 4 1
A setMemoryHigh() 0 5 1
A getMemoryLimit() 0 4 1
A setMemoryLimit() 0 5 1
A getMemoryLow() 0 4 1
A setMemoryLow() 0 5 1
A getMemoryMax() 0 4 1
A setMemoryMax() 0 5 1
A getMemorySwapMax() 0 4 1
A setMemorySwapMax() 0 5 1
A getRequiredBy() 0 4 1
A setRequiredBy() 0 5 1
A getRequires() 0 4 1
A setRequires() 0 5 1
A getSlice() 0 4 1
A setSlice() 0 5 1
A getStartupBlockIOWeight() 0 4 1
A setStartupBlockIOWeight() 0 5 1
A getStartupCPUShares() 0 4 1
A setStartupCPUShares() 0 5 1
A getStartupCPUWeight() 0 4 1
A setStartupCPUWeight() 0 5 1
A getStartupIOWeight() 0 4 1
A setStartupIOWeight() 0 5 1
A getTasksAccounting() 0 4 1
A setTasksAccounting() 0 5 1
A getTasksCurrent() 0 4 1
A setTasksCurrent() 0 5 1
A getTasksMax() 0 4 1
A setTasksMax() 0 5 1
A getUnitFilePreset() 0 4 1
A setUnitFilePreset() 0 5 1
A getUnitFileState() 0 4 1
A setUnitFileState() 0 5 1
A getWantedBy() 0 4 1
A setWantedBy() 0 5 1

How to fix   Complexity   

Complex Class

Complex classes like Slice 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

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 Slice, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace CyberLine\SystemdState\Types;
4
5
class Slice extends AbstractType
6
{
7
    protected $After = [];
8
9
    protected $BlockIOAccounting;
10
11
    protected $BlockIOWeight;
12
13
    protected $CPUAccounting;
14
15
    protected $CPUQuotaPerSecUSec;
16
17
    protected $CPUShares;
18
19
    protected $CPUUsageNSec;
20
21
    protected $CPUWeight;
22
23
    protected $Conflicts = [];
24
25
    protected $ControlGroup;
26
27
    protected $Delegate;
28
29
    protected $DevicePolicy;
30
31
    protected $Documentation = [];
32
33
    protected $DropInPaths = [];
34
35
    protected $FragmentPath;
36
37
    protected $IOAccounting;
38
39
    protected $IOWeight;
40
41
    protected $MemoryAccounting;
42
43
    protected $MemoryCurrent;
44
45
    protected $MemoryHigh;
46
47
    protected $MemoryLimit;
48
49
    protected $MemoryLow;
50
51
    protected $MemoryMax;
52
53
    protected $MemorySwapMax;
54
55
    protected $RequiredBy = [];
56
57
    protected $Requires = [];
58
59
    protected $Slice;
60
61
    protected $StartupBlockIOWeight;
62
63
    protected $StartupCPUShares;
64
65
    protected $StartupCPUWeight;
66
67
    protected $StartupIOWeight;
68
69
    protected $TasksAccounting;
70
71
    protected $TasksCurrent;
72
73
    protected $TasksMax;
74
75
    protected $UnitFilePreset;
76
77
    protected $UnitFileState;
78
79
    protected $WantedBy = [];
80
81
    /**
82
     * @return array
83
     */
84
    public function getAfter(): array
85
    {
86
        return $this->After;
87
    }
88
89
    /**
90
     * @param array $After
91
     * @return Slice
92
     */
93
    public function setAfter(array $After): Slice
94
    {
95
        $this->After = $After;
96
        return $this;
97
    }
98
99
    /**
100
     * @return mixed
101
     */
102
    public function getBlockIOAccounting()
103
    {
104
        return $this->BlockIOAccounting;
105
    }
106
107
    /**
108
     * @param mixed $BlockIOAccounting
109
     * @return Slice
110
     */
111
    public function setBlockIOAccounting($BlockIOAccounting)
112
    {
113
        $this->BlockIOAccounting = $BlockIOAccounting;
114
        return $this;
115
    }
116
117
    /**
118
     * @return mixed
119
     */
120
    public function getBlockIOWeight()
121
    {
122
        return $this->BlockIOWeight;
123
    }
124
125
    /**
126
     * @param mixed $BlockIOWeight
127
     * @return Slice
128
     */
129
    public function setBlockIOWeight($BlockIOWeight)
130
    {
131
        $this->BlockIOWeight = $BlockIOWeight;
132
        return $this;
133
    }
134
135
    /**
136
     * @return mixed
137
     */
138
    public function getCPUAccounting()
139
    {
140
        return $this->CPUAccounting;
141
    }
142
143
    /**
144
     * @param mixed $CPUAccounting
145
     * @return Slice
146
     */
147
    public function setCPUAccounting($CPUAccounting)
148
    {
149
        $this->CPUAccounting = $CPUAccounting;
150
        return $this;
151
    }
152
153
    /**
154
     * @return mixed
155
     */
156
    public function getCPUQuotaPerSecUSec()
157
    {
158
        return $this->CPUQuotaPerSecUSec;
159
    }
160
161
    /**
162
     * @param mixed $CPUQuotaPerSecUSec
163
     * @return Slice
164
     */
165
    public function setCPUQuotaPerSecUSec($CPUQuotaPerSecUSec)
166
    {
167
        $this->CPUQuotaPerSecUSec = $CPUQuotaPerSecUSec;
168
        return $this;
169
    }
170
171
    /**
172
     * @return mixed
173
     */
174
    public function getCPUShares()
175
    {
176
        return $this->CPUShares;
177
    }
178
179
    /**
180
     * @param mixed $CPUShares
181
     * @return Slice
182
     */
183
    public function setCPUShares($CPUShares)
184
    {
185
        $this->CPUShares = $CPUShares;
186
        return $this;
187
    }
188
189
    /**
190
     * @return mixed
191
     */
192
    public function getCPUUsageNSec()
193
    {
194
        return $this->CPUUsageNSec;
195
    }
196
197
    /**
198
     * @param mixed $CPUUsageNSec
199
     * @return Slice
200
     */
201
    public function setCPUUsageNSec($CPUUsageNSec)
202
    {
203
        $this->CPUUsageNSec = $CPUUsageNSec;
204
        return $this;
205
    }
206
207
    /**
208
     * @return mixed
209
     */
210
    public function getCPUWeight()
211
    {
212
        return $this->CPUWeight;
213
    }
214
215
    /**
216
     * @param mixed $CPUWeight
217
     * @return Slice
218
     */
219
    public function setCPUWeight($CPUWeight)
220
    {
221
        $this->CPUWeight = $CPUWeight;
222
        return $this;
223
    }
224
225
    /**
226
     * @return array
227
     */
228
    public function getConflicts(): array
229
    {
230
        return $this->Conflicts;
231
    }
232
233
    /**
234
     * @param array $Conflicts
235
     * @return Slice
236
     */
237
    public function setConflicts(array $Conflicts): Slice
238
    {
239
        $this->Conflicts = $Conflicts;
240
        return $this;
241
    }
242
243
    /**
244
     * @return mixed
245
     */
246
    public function getControlGroup()
247
    {
248
        return $this->ControlGroup;
249
    }
250
251
    /**
252
     * @param mixed $ControlGroup
253
     * @return Slice
254
     */
255
    public function setControlGroup($ControlGroup)
256
    {
257
        $this->ControlGroup = $ControlGroup;
258
        return $this;
259
    }
260
261
    /**
262
     * @return mixed
263
     */
264
    public function getDelegate()
265
    {
266
        return $this->Delegate;
267
    }
268
269
    /**
270
     * @param mixed $Delegate
271
     * @return Slice
272
     */
273
    public function setDelegate($Delegate)
274
    {
275
        $this->Delegate = $Delegate;
276
        return $this;
277
    }
278
279
    /**
280
     * @return mixed
281
     */
282
    public function getDevicePolicy()
283
    {
284
        return $this->DevicePolicy;
285
    }
286
287
    /**
288
     * @param mixed $DevicePolicy
289
     * @return Slice
290
     */
291
    public function setDevicePolicy($DevicePolicy)
292
    {
293
        $this->DevicePolicy = $DevicePolicy;
294
        return $this;
295
    }
296
297
    /**
298
     * @return array
299
     */
300
    public function getDropInPaths(): array
301
    {
302
        return $this->DropInPaths;
303
    }
304
305
    /**
306
     * @param array $DropInPaths
307
     * @return Slice
308
     */
309
    public function setDropInPaths(array $DropInPaths): Slice
310
    {
311
        $this->DropInPaths = $DropInPaths;
312
        return $this;
313
    }
314
315
    /**
316
     * @return array
317
     */
318
    public function getDocumentation(): array
319
    {
320
        return $this->Documentation;
321
    }
322
323
    /**
324
     * @param array $Documentation
325
     * @return Slice
326
     */
327
    public function setDocumentation(array $Documentation): Slice
328
    {
329
        $this->Documentation = $Documentation;
330
        return $this;
331
    }
332
333
    /**
334
     * @return mixed
335
     */
336
    public function getFragmentPath()
337
    {
338
        return $this->FragmentPath;
339
    }
340
341
    /**
342
     * @param mixed $FragmentPath
343
     * @return Slice
344
     */
345
    public function setFragmentPath($FragmentPath)
346
    {
347
        $this->FragmentPath = $FragmentPath;
348
        return $this;
349
    }
350
351
    /**
352
     * @return mixed
353
     */
354
    public function getIOAccounting()
355
    {
356
        return $this->IOAccounting;
357
    }
358
359
    /**
360
     * @param mixed $IOAccounting
361
     * @return Slice
362
     */
363
    public function setIOAccounting($IOAccounting)
364
    {
365
        $this->IOAccounting = $IOAccounting;
366
        return $this;
367
    }
368
369
    /**
370
     * @return mixed
371
     */
372
    public function getIOWeight()
373
    {
374
        return $this->IOWeight;
375
    }
376
377
    /**
378
     * @param mixed $IOWeight
379
     * @return Slice
380
     */
381
    public function setIOWeight($IOWeight)
382
    {
383
        $this->IOWeight = $IOWeight;
384
        return $this;
385
    }
386
387
    /**
388
     * @return mixed
389
     */
390
    public function getMemoryAccounting()
391
    {
392
        return $this->MemoryAccounting;
393
    }
394
395
    /**
396
     * @param mixed $MemoryAccounting
397
     * @return Slice
398
     */
399
    public function setMemoryAccounting($MemoryAccounting)
400
    {
401
        $this->MemoryAccounting = $MemoryAccounting;
402
        return $this;
403
    }
404
405
    /**
406
     * @return mixed
407
     */
408
    public function getMemoryCurrent()
409
    {
410
        return $this->MemoryCurrent;
411
    }
412
413
    /**
414
     * @param mixed $MemoryCurrent
415
     * @return Slice
416
     */
417
    public function setMemoryCurrent($MemoryCurrent)
418
    {
419
        $this->MemoryCurrent = $MemoryCurrent;
420
        return $this;
421
    }
422
423
    /**
424
     * @return mixed
425
     */
426
    public function getMemoryHigh()
427
    {
428
        return $this->MemoryHigh;
429
    }
430
431
    /**
432
     * @param mixed $MemoryHigh
433
     * @return Slice
434
     */
435
    public function setMemoryHigh($MemoryHigh)
436
    {
437
        $this->MemoryHigh = $MemoryHigh;
438
        return $this;
439
    }
440
441
    /**
442
     * @return mixed
443
     */
444
    public function getMemoryLimit()
445
    {
446
        return $this->MemoryLimit;
447
    }
448
449
    /**
450
     * @param mixed $MemoryLimit
451
     * @return Slice
452
     */
453
    public function setMemoryLimit($MemoryLimit)
454
    {
455
        $this->MemoryLimit = $MemoryLimit;
456
        return $this;
457
    }
458
459
    /**
460
     * @return mixed
461
     */
462
    public function getMemoryLow()
463
    {
464
        return $this->MemoryLow;
465
    }
466
467
    /**
468
     * @param mixed $MemoryLow
469
     * @return Slice
470
     */
471
    public function setMemoryLow($MemoryLow)
472
    {
473
        $this->MemoryLow = $MemoryLow;
474
        return $this;
475
    }
476
477
    /**
478
     * @return mixed
479
     */
480
    public function getMemoryMax()
481
    {
482
        return $this->MemoryMax;
483
    }
484
485
    /**
486
     * @param mixed $MemoryMax
487
     * @return Slice
488
     */
489
    public function setMemoryMax($MemoryMax)
490
    {
491
        $this->MemoryMax = $MemoryMax;
492
        return $this;
493
    }
494
495
    /**
496
     * @return mixed
497
     */
498
    public function getMemorySwapMax()
499
    {
500
        return $this->MemorySwapMax;
501
    }
502
503
    /**
504
     * @param mixed $MemorySwapMax
505
     * @return Slice
506
     */
507
    public function setMemorySwapMax($MemorySwapMax)
508
    {
509
        $this->MemorySwapMax = $MemorySwapMax;
510
        return $this;
511
    }
512
513
    /**
514
     * @return array
515
     */
516
    public function getRequiredBy(): array
517
    {
518
        return $this->RequiredBy;
519
    }
520
521
    /**
522
     * @param array $RequiredBy
523
     * @return Slice
524
     */
525
    public function setRequiredBy(array $RequiredBy): Slice
526
    {
527
        $this->RequiredBy = $RequiredBy;
528
        return $this;
529
    }
530
531
    /**
532
     * @return array
533
     */
534
    public function getRequires(): array
535
    {
536
        return $this->Requires;
537
    }
538
539
    /**
540
     * @param array $Requires
541
     * @return Slice
542
     */
543
    public function setRequires(array $Requires): Slice
544
    {
545
        $this->Requires = $Requires;
546
        return $this;
547
    }
548
549
    /**
550
     * @return mixed
551
     */
552
    public function getSlice()
553
    {
554
        return $this->Slice;
555
    }
556
557
    /**
558
     * @param mixed $Slice
559
     * @return Slice
560
     */
561
    public function setSlice($Slice)
562
    {
563
        $this->Slice = $Slice;
564
        return $this;
565
    }
566
567
    /**
568
     * @return mixed
569
     */
570
    public function getStartupBlockIOWeight()
571
    {
572
        return $this->StartupBlockIOWeight;
573
    }
574
575
    /**
576
     * @param mixed $StartupBlockIOWeight
577
     * @return Slice
578
     */
579
    public function setStartupBlockIOWeight($StartupBlockIOWeight)
580
    {
581
        $this->StartupBlockIOWeight = $StartupBlockIOWeight;
582
        return $this;
583
    }
584
585
    /**
586
     * @return mixed
587
     */
588
    public function getStartupCPUShares()
589
    {
590
        return $this->StartupCPUShares;
591
    }
592
593
    /**
594
     * @param mixed $StartupCPUShares
595
     * @return Slice
596
     */
597
    public function setStartupCPUShares($StartupCPUShares)
598
    {
599
        $this->StartupCPUShares = $StartupCPUShares;
600
        return $this;
601
    }
602
603
    /**
604
     * @return mixed
605
     */
606
    public function getStartupCPUWeight()
607
    {
608
        return $this->StartupCPUWeight;
609
    }
610
611
    /**
612
     * @param mixed $StartupCPUWeight
613
     * @return Slice
614
     */
615
    public function setStartupCPUWeight($StartupCPUWeight)
616
    {
617
        $this->StartupCPUWeight = $StartupCPUWeight;
618
        return $this;
619
    }
620
621
    /**
622
     * @return mixed
623
     */
624
    public function getStartupIOWeight()
625
    {
626
        return $this->StartupIOWeight;
627
    }
628
629
    /**
630
     * @param mixed $StartupIOWeight
631
     * @return Slice
632
     */
633
    public function setStartupIOWeight($StartupIOWeight)
634
    {
635
        $this->StartupIOWeight = $StartupIOWeight;
636
        return $this;
637
    }
638
639
    /**
640
     * @return mixed
641
     */
642
    public function getTasksAccounting()
643
    {
644
        return $this->TasksAccounting;
645
    }
646
647
    /**
648
     * @param mixed $TasksAccounting
649
     * @return Slice
650
     */
651
    public function setTasksAccounting($TasksAccounting)
652
    {
653
        $this->TasksAccounting = $TasksAccounting;
654
        return $this;
655
    }
656
657
    /**
658
     * @return mixed
659
     */
660
    public function getTasksCurrent()
661
    {
662
        return $this->TasksCurrent;
663
    }
664
665
    /**
666
     * @param mixed $TasksCurrent
667
     * @return Slice
668
     */
669
    public function setTasksCurrent($TasksCurrent)
670
    {
671
        $this->TasksCurrent = $TasksCurrent;
672
        return $this;
673
    }
674
675
    /**
676
     * @return mixed
677
     */
678
    public function getTasksMax()
679
    {
680
        return $this->TasksMax;
681
    }
682
683
    /**
684
     * @param mixed $TasksMax
685
     * @return Slice
686
     */
687
    public function setTasksMax($TasksMax)
688
    {
689
        $this->TasksMax = $TasksMax;
690
        return $this;
691
    }
692
693
    /**
694
     * @return mixed
695
     */
696
    public function getUnitFilePreset()
697
    {
698
        return $this->UnitFilePreset;
699
    }
700
701
    /**
702
     * @param mixed $UnitFilePreset
703
     * @return Slice
704
     */
705
    public function setUnitFilePreset($UnitFilePreset)
706
    {
707
        $this->UnitFilePreset = $UnitFilePreset;
708
        return $this;
709
    }
710
711
    /**
712
     * @return mixed
713
     */
714
    public function getUnitFileState()
715
    {
716
        return $this->UnitFileState;
717
    }
718
719
    /**
720
     * @param mixed $UnitFileState
721
     * @return Slice
722
     */
723
    public function setUnitFileState($UnitFileState)
724
    {
725
        $this->UnitFileState = $UnitFileState;
726
        return $this;
727
    }
728
729
    /**
730
     * @return array
731
     */
732
    public function getWantedBy(): array
733
    {
734
        return $this->WantedBy;
735
    }
736
737
    /**
738
     * @param array $WantedBy
739
     * @return Slice
740
     */
741
    public function setWantedBy(array $WantedBy): Slice
742
    {
743
        $this->WantedBy = $WantedBy;
744
        return $this;
745
    }
746
}
747