Passed
Push — master ( c9be78...243230 )
by Nico
22:39
created

ShipRumpModuleLevel::getModuleMandatory9()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\GeneratedValue;
10
use Doctrine\ORM\Mapping\Id;
11
use Doctrine\ORM\Mapping\Index;
12
use Doctrine\ORM\Mapping\Table;
13
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use RuntimeException;
15
use Stu\Component\Spacecraft\SpacecraftModuleTypeEnum;
16
use Stu\Orm\Repository\ShipRumpModuleLevelRepository;
17
18
#[Table(name: 'stu_rumps_module_level')]
19
#[Index(name: 'rump_module_level_ship_rump_idx', columns: ['rump_id'])]
20
#[Entity(repositoryClass: ShipRumpModuleLevelRepository::class)]
21
class ShipRumpModuleLevel implements ShipRumpModuleLevelInterface
22
{
23
    #[Id]
24
    #[Column(type: 'integer')]
25
    #[GeneratedValue(strategy: 'IDENTITY')]
26
    private int $id;
27
28
    #[Column(type: 'integer')]
29
    private int $rump_id = 0;
30
31
    #[Column(type: 'smallint')]
32
    private int $module_level_1 = 0;
33
34
    #[Column(type: 'smallint')]
35
    private int $module_mandatory_1 = 0;
36
37
    #[Column(type: 'smallint')]
38
    private int $module_level_1_min = 0;
39
40
    #[Column(type: 'smallint')]
41
    private int $module_level_1_max = 0;
42
43
    #[Column(type: 'smallint')]
44
    private int $module_level_2 = 0;
45
46
    #[Column(type: 'smallint')]
47
    private int $module_mandatory_2 = 0;
48
49
    #[Column(type: 'smallint')]
50
    private int $module_level_2_min = 0;
51
52
    #[Column(type: 'smallint')]
53
    private int $module_level_2_max = 0;
54
55
    #[Column(type: 'smallint')]
56
    private int $module_level_3 = 0;
57
58
    #[Column(type: 'smallint')]
59
    private int $module_mandatory_3 = 0;
60
61
    #[Column(type: 'smallint')]
62
    private int $module_level_3_min = 0;
63
64
    #[Column(type: 'smallint')]
65
    private int $module_level_3_max = 0;
66
67
    #[Column(type: 'smallint')]
68
    private int $module_level_4 = 0;
69
70
    #[Column(type: 'smallint')]
71
    private int $module_mandatory_4 = 0;
72
73
    #[Column(type: 'smallint')]
74
    private int $module_level_4_min = 0;
75
76
    #[Column(type: 'smallint')]
77
    private int $module_level_4_max = 0;
78
79
    #[Column(type: 'smallint')]
80
    private int $module_level_5 = 0;
81
82
    #[Column(type: 'smallint')]
83
    private int $module_mandatory_5 = 0;
84
85
    #[Column(type: 'smallint')]
86
    private int $module_level_5_min = 0;
87
88
    #[Column(type: 'smallint')]
89
    private int $module_level_5_max = 0;
90
91
    #[Column(type: 'smallint')]
92
    private int $module_level_6 = 0;
93
94
    #[Column(type: 'smallint')]
95
    private int $module_mandatory_6 = 0;
96
97
    #[Column(type: 'smallint')]
98
    private int $module_level_6_min = 0;
99
100
    #[Column(type: 'smallint')]
101
    private int $module_level_6_max = 0;
102
103
    #[Column(type: 'smallint')]
104
    private int $module_level_7 = 0;
105
106
    #[Column(type: 'smallint')]
107
    private int $module_mandatory_7 = 0;
108
109
    #[Column(type: 'smallint')]
110
    private int $module_level_7_min = 0;
111
112
    #[Column(type: 'smallint')]
113
    private int $module_level_7_max = 0;
114
115
    #[Column(type: 'smallint')]
116
    private int $module_level_8 = 0;
117
118
    #[Column(type: 'smallint')]
119
    private int $module_mandatory_8 = 0;
120
121
    #[Column(type: 'smallint')]
122
    private int $module_level_8_min = 0;
123
124
    #[Column(type: 'smallint')]
125
    private int $module_level_8_max = 0;
126
127
    #[Column(type: 'smallint')]
128
    private int $module_level_10 = 0;
129
130
    #[Column(type: 'smallint')]
131
    private int $module_mandatory_10 = 0;
132
133
    #[Column(type: 'smallint')]
134
    private int $module_level_10_min = 0;
135
136
    #[Column(type: 'smallint')]
137
    private int $module_level_10_max = 0;
138
139
    #[Column(type: 'smallint')]
140
    private int $module_level_11 = 0;
141
142
    #[Column(type: 'smallint')]
143
    private int $module_mandatory_11 = 0;
144
145
    #[Column(type: 'smallint')]
146
    private int $module_level_11_min = 0;
147
148
    #[Column(type: 'smallint')]
149
    private int $module_level_11_max = 0;
150
151
    #[Override]
152
    public function getId(): int
153
    {
154
        return $this->id;
155
    }
156
157
    #[Override]
158
    public function getRumpId(): int
159
    {
160
        return $this->rump_id;
161
    }
162
163 3
    #[Override]
164
    public function getModuleLevel1(): int
165
    {
166 3
        return $this->module_level_1;
167
    }
168
169
    #[Override]
170
    public function setModuleLevel1(int $moduleLevel1): ShipRumpModuleLevelInterface
171
    {
172
        $this->module_level_1 = $moduleLevel1;
173
174
        return $this;
175
    }
176
177 3
    #[Override]
178
    public function getModuleMandatory1(): bool
179
    {
180 3
        return $this->module_mandatory_1 === self::MODULE_MANDATORY;
181
    }
182
183
    #[Override]
184
    public function setModuleMandatory1(int $moduleMandatory1): ShipRumpModuleLevelInterface
185
    {
186
        $this->module_mandatory_1 = $moduleMandatory1;
187
188
        return $this;
189
    }
190
191 4
    #[Override]
192
    public function getModuleLevel1Min(): int
193
    {
194 4
        return $this->module_level_1_min;
195
    }
196
197
    #[Override]
198
    public function setModuleLevel1Min(int $moduleLevel1Min): ShipRumpModuleLevelInterface
199
    {
200
        $this->module_level_1_min = $moduleLevel1Min;
201
202
        return $this;
203
    }
204
205 4
    #[Override]
206
    public function getModuleLevel1Max(): int
207
    {
208 4
        return $this->module_level_1_max;
209
    }
210
211
    #[Override]
212
    public function setModuleLevel1Max(int $moduleLevel1Max): ShipRumpModuleLevelInterface
213
    {
214
        $this->module_level_1_max = $moduleLevel1Max;
215
216
        return $this;
217
    }
218
219 3
    #[Override]
220
    public function getModuleLevel2(): int
221
    {
222 3
        return $this->module_level_2;
223
    }
224
225
    #[Override]
226
    public function setModuleLevel2(int $moduleLevel2): ShipRumpModuleLevelInterface
227
    {
228
        $this->module_level_2 = $moduleLevel2;
229
230
        return $this;
231
    }
232
233 3
    #[Override]
234
    public function getModuleMandatory2(): bool
235
    {
236 3
        return $this->module_mandatory_2 === self::MODULE_MANDATORY;
237
    }
238
239
    #[Override]
240
    public function setModuleMandatory2(int $moduleMandatory2): ShipRumpModuleLevelInterface
241
    {
242
        $this->module_mandatory_2 = $moduleMandatory2;
243
244
        return $this;
245
    }
246
247 3
    #[Override]
248
    public function getModuleLevel2Min(): int
249
    {
250 3
        return $this->module_level_2_min;
251
    }
252
253
    #[Override]
254
    public function setModuleLevel2Min(int $moduleLevel2Min): ShipRumpModuleLevelInterface
255
    {
256
        $this->module_level_2_min = $moduleLevel2Min;
257
258
        return $this;
259
    }
260
261 3
    #[Override]
262
    public function getModuleLevel2Max(): int
263
    {
264 3
        return $this->module_level_2_max;
265
    }
266
267
    #[Override]
268
    public function setModuleLevel2Max(int $moduleLevel2Max): ShipRumpModuleLevelInterface
269
    {
270
        $this->module_level_2_max = $moduleLevel2Max;
271
272
        return $this;
273
    }
274
275 3
    #[Override]
276
    public function getModuleLevel3(): int
277
    {
278 3
        return $this->module_level_3;
279
    }
280
281
    #[Override]
282
    public function setModuleLevel3(int $moduleLevel3): ShipRumpModuleLevelInterface
283
    {
284
        $this->module_level_3 = $moduleLevel3;
285
286
        return $this;
287
    }
288
289 3
    #[Override]
290
    public function getModuleMandatory3(): bool
291
    {
292 3
        return $this->module_mandatory_3 === self::MODULE_MANDATORY;
293
    }
294
295
    #[Override]
296
    public function setModuleMandatory3(int $moduleMandatory3): ShipRumpModuleLevelInterface
297
    {
298
        $this->module_mandatory_3 = $moduleMandatory3;
299
300
        return $this;
301
    }
302
303 3
    #[Override]
304
    public function getModuleLevel3Min(): int
305
    {
306 3
        return $this->module_level_3_min;
307
    }
308
309
    #[Override]
310
    public function setModuleLevel3Min(int $moduleLevel3Min): ShipRumpModuleLevelInterface
311
    {
312
        $this->module_level_3_min = $moduleLevel3Min;
313
314
        return $this;
315
    }
316
317 3
    #[Override]
318
    public function getModuleLevel3Max(): int
319
    {
320 3
        return $this->module_level_3_max;
321
    }
322
323
    #[Override]
324
    public function setModuleLevel3Max(int $moduleLevel3Max): ShipRumpModuleLevelInterface
325
    {
326
        $this->module_level_3_max = $moduleLevel3Max;
327
328
        return $this;
329
    }
330
331 3
    #[Override]
332
    public function getModuleLevel4(): int
333
    {
334 3
        return $this->module_level_4;
335
    }
336
337
    #[Override]
338
    public function setModuleLevel4(int $moduleLevel4): ShipRumpModuleLevelInterface
339
    {
340
        $this->module_level_4 = $moduleLevel4;
341
342
        return $this;
343
    }
344
345 3
    #[Override]
346
    public function getModuleMandatory4(): bool
347
    {
348 3
        return $this->module_mandatory_4 === self::MODULE_MANDATORY;
349
    }
350
351
    #[Override]
352
    public function setModuleMandatory4(int $moduleMandatory4): ShipRumpModuleLevelInterface
353
    {
354
        $this->module_mandatory_4 = $moduleMandatory4;
355
356
        return $this;
357
    }
358
359 3
    #[Override]
360
    public function getModuleLevel4Min(): int
361
    {
362 3
        return $this->module_level_4_min;
363
    }
364
365
    #[Override]
366
    public function setModuleLevel4Min(int $moduleLevel4Min): ShipRumpModuleLevelInterface
367
    {
368
        $this->module_level_4_min = $moduleLevel4Min;
369
370
        return $this;
371
    }
372
373 3
    #[Override]
374
    public function getModuleLevel4Max(): int
375
    {
376 3
        return $this->module_level_4_max;
377
    }
378
379
    #[Override]
380
    public function setModuleLevel4Max(int $moduleLevel4Max): ShipRumpModuleLevelInterface
381
    {
382
        $this->module_level_4_max = $moduleLevel4Max;
383
384
        return $this;
385
    }
386
387 3
    #[Override]
388
    public function getModuleLevel5(): int
389
    {
390 3
        return $this->module_level_5;
391
    }
392
393
    #[Override]
394
    public function setModuleLevel5(int $moduleLevel5): ShipRumpModuleLevelInterface
395
    {
396
        $this->module_level_5 = $moduleLevel5;
397
398
        return $this;
399
    }
400
401 3
    #[Override]
402
    public function getModuleMandatory5(): bool
403
    {
404 3
        return $this->module_mandatory_5 === self::MODULE_MANDATORY;
405
    }
406
407
    #[Override]
408
    public function setModuleMandatory5(int $moduleMandatory5): ShipRumpModuleLevelInterface
409
    {
410
        $this->module_mandatory_5 = $moduleMandatory5;
411
412
        return $this;
413
    }
414
415 3
    #[Override]
416
    public function getModuleLevel5Min(): int
417
    {
418 3
        return $this->module_level_5_min;
419
    }
420
421
    #[Override]
422
    public function setModuleLevel5Min(int $moduleLevel5Min): ShipRumpModuleLevelInterface
423
    {
424
        $this->module_level_5_min = $moduleLevel5Min;
425
426
        return $this;
427
    }
428
429 3
    #[Override]
430
    public function getModuleLevel5Max(): int
431
    {
432 3
        return $this->module_level_5_max;
433
    }
434
435
    #[Override]
436
    public function setModuleLevel5Max(int $moduleLevel5Max): ShipRumpModuleLevelInterface
437
    {
438
        $this->module_level_5_max = $moduleLevel5Max;
439
440
        return $this;
441
    }
442
443 3
    #[Override]
444
    public function getModuleLevel6(): int
445
    {
446 3
        return $this->module_level_6;
447
    }
448
449
    #[Override]
450
    public function setModuleLevel6(int $moduleLevel6): ShipRumpModuleLevelInterface
451
    {
452
        $this->module_level_6 = $moduleLevel6;
453
454
        return $this;
455
    }
456
457 3
    #[Override]
458
    public function getModuleMandatory6(): bool
459
    {
460 3
        return $this->module_mandatory_6 === self::MODULE_MANDATORY;
461
    }
462
463
    #[Override]
464
    public function setModuleMandatory6(int $moduleMandatory6): ShipRumpModuleLevelInterface
465
    {
466
        $this->module_mandatory_6 = $moduleMandatory6;
467
468
        return $this;
469
    }
470
471 3
    #[Override]
472
    public function getModuleLevel6Min(): int
473
    {
474 3
        return $this->module_level_6_min;
475
    }
476
477
    #[Override]
478
    public function setModuleLevel6Min(int $moduleLevel6Min): ShipRumpModuleLevelInterface
479
    {
480
        $this->module_level_6_min = $moduleLevel6Min;
481
482
        return $this;
483
    }
484
485 3
    #[Override]
486
    public function getModuleLevel6Max(): int
487
    {
488 3
        return $this->module_level_6_max;
489
    }
490
491
    #[Override]
492
    public function setModuleLevel6Max(int $moduleLevel6Max): ShipRumpModuleLevelInterface
493
    {
494
        $this->module_level_6_max = $moduleLevel6Max;
495
496
        return $this;
497
    }
498
499 3
    #[Override]
500
    public function getModuleLevel7(): int
501
    {
502 3
        return $this->module_level_7;
503
    }
504
505
    #[Override]
506
    public function setModuleLevel7(int $moduleLevel7): ShipRumpModuleLevelInterface
507
    {
508
        $this->module_level_7 = $moduleLevel7;
509
510
        return $this;
511
    }
512
513 3
    #[Override]
514
    public function getModuleMandatory7(): bool
515
    {
516 3
        return $this->module_mandatory_7 === self::MODULE_MANDATORY;
517
    }
518
519
    #[Override]
520
    public function setModuleMandatory7(int $moduleMandatory7): ShipRumpModuleLevelInterface
521
    {
522
        $this->module_mandatory_7 = $moduleMandatory7;
523
524
        return $this;
525
    }
526
527 3
    #[Override]
528
    public function getModuleLevel7Min(): int
529
    {
530 3
        return $this->module_level_7_min;
531
    }
532
533
    #[Override]
534
    public function setModuleLevel7Min(int $moduleLevel7Min): ShipRumpModuleLevelInterface
535
    {
536
        $this->module_level_7_min = $moduleLevel7Min;
537
538
        return $this;
539
    }
540
541 3
    #[Override]
542
    public function getModuleLevel7Max(): int
543
    {
544 3
        return $this->module_level_7_max;
545
    }
546
547
    #[Override]
548
    public function setModuleLevel7Max(int $moduleLevel7Max): ShipRumpModuleLevelInterface
549
    {
550
        $this->module_level_7_max = $moduleLevel7Max;
551
552
        return $this;
553
    }
554
555 3
    #[Override]
556
    public function getModuleLevel8(): int
557
    {
558 3
        return $this->module_level_8;
559
    }
560
561
    #[Override]
562
    public function setModuleLevel8(int $moduleLevel8): ShipRumpModuleLevelInterface
563
    {
564
        $this->module_level_8 = $moduleLevel8;
565
566
        return $this;
567
    }
568
569
    #[Override]
570
    public function getModuleMandatory8(): bool
571
    {
572
        return $this->module_mandatory_8 === self::MODULE_MANDATORY;
573
    }
574
575
    #[Override]
576
    public function setModuleMandatory8(int $moduleMandatory8): ShipRumpModuleLevelInterface
577
    {
578
        $this->module_mandatory_8 = $moduleMandatory8;
579
580
        return $this;
581
    }
582
583 3
    #[Override]
584
    public function getModuleLevel8Min(): int
585
    {
586 3
        return $this->module_level_8_min;
587
    }
588
589
    #[Override]
590
    public function setModuleLevel8Min(int $moduleLevel8Min): ShipRumpModuleLevelInterface
591
    {
592
        $this->module_level_8_min = $moduleLevel8Min;
593
594
        return $this;
595
    }
596
597 3
    #[Override]
598
    public function getModuleLevel8Max(): int
599
    {
600 3
        return $this->module_level_8_max;
601
    }
602
603
    #[Override]
604
    public function setModuleLevel8Max(int $moduleLevel8Max): ShipRumpModuleLevelInterface
605
    {
606
        $this->module_level_8_max = $moduleLevel8Max;
607
608
        return $this;
609
    }
610
611
    #[Override]
612
    public function getModuleLevel9(): int
613
    {
614
        throw new RuntimeException('this should not be called!');
615
    }
616
617
    #[Override]
618
    public function getModuleMandatory9(): bool
619
    {
620
        throw new RuntimeException('this should not be called!');
621
    }
622
623
    #[Override]
624
    public function getModuleLevel9Min(): int
625
    {
626
        throw new RuntimeException('this should not be called!');
627
    }
628
629
    #[Override]
630
    public function getModuleLevel9Max(): int
631
    {
632
        throw new RuntimeException('this should not be called!');
633
    }
634
635 3
    #[Override]
636
    public function getModuleLevel10(): int
637
    {
638 3
        return $this->module_level_10;
639
    }
640
641
    #[Override]
642
    public function setModuleLevel10(int $moduleLevel10): ShipRumpModuleLevelInterface
643
    {
644
        $this->module_level_10 = $moduleLevel10;
645
646
        return $this;
647
    }
648
649 3
    #[Override]
650
    public function getModuleMandatory10(): bool
651
    {
652 3
        return $this->module_mandatory_10 === self::MODULE_MANDATORY;
653
    }
654
655
    #[Override]
656
    public function setModuleMandatory10(int $moduleMandatory10): ShipRumpModuleLevelInterface
657
    {
658
        $this->module_mandatory_10 = $moduleMandatory10;
659
660
        return $this;
661
    }
662
663 3
    #[Override]
664
    public function getModuleLevel10Min(): int
665
    {
666 3
        return $this->module_level_10_min;
667
    }
668
669
    #[Override]
670
    public function setModuleLevel10Min(int $moduleLevel10Min): ShipRumpModuleLevelInterface
671
    {
672
        $this->module_level_10_min = $moduleLevel10Min;
673
674
        return $this;
675
    }
676
677 3
    #[Override]
678
    public function getModuleLevel10Max(): int
679
    {
680 3
        return $this->module_level_10_max;
681
    }
682
683
    #[Override]
684
    public function setModuleLevel10Max(int $moduleLevel10Max): ShipRumpModuleLevelInterface
685
    {
686
        $this->module_level_10_max = $moduleLevel10Max;
687
688
        return $this;
689
    }
690
691 3
    #[Override]
692
    public function getModuleLevel11(): int
693
    {
694 3
        return $this->module_level_11;
695
    }
696
697
    #[Override]
698
    public function setModuleLevel11(int $moduleLevel11): ShipRumpModuleLevelInterface
699
    {
700
        $this->module_level_11 = $moduleLevel11;
701
702
        return $this;
703
    }
704
705 3
    #[Override]
706
    public function getModuleMandatory11(): bool
707
    {
708 3
        return $this->module_mandatory_11 === self::MODULE_MANDATORY;
709
    }
710
711
    #[Override]
712
    public function setModuleMandatory11(int $moduleMandatory11): ShipRumpModuleLevelInterface
713
    {
714
        $this->module_mandatory_11 = $moduleMandatory11;
715
716
        return $this;
717
    }
718
719 3
    #[Override]
720
    public function getModuleLevel11Min(): int
721
    {
722 3
        return $this->module_level_11_min;
723
    }
724
725
    #[Override]
726
    public function setModuleLevel11Min(int $moduleLevel11Min): ShipRumpModuleLevelInterface
727
    {
728
        $this->module_level_11_min = $moduleLevel11Min;
729
730
        return $this;
731
    }
732
733 3
    #[Override]
734
    public function getModuleLevel11Max(): int
735
    {
736 3
        return $this->module_level_11_max;
737
    }
738
739
    #[Override]
740
    public function setModuleLevel11Max(int $moduleLevel11Max): ShipRumpModuleLevelInterface
741
    {
742
        $this->module_level_11_max = $moduleLevel11Max;
743
744
        return $this;
745
    }
746
747
748
    #[Override]
749
    public function getMandatoryModulesCount(): int
750
    {
751
        return array_reduce(
752
            array_map(
753
                fn(SpacecraftModuleTypeEnum $type): string =>
754
                sprintf('getModuleMandatory%d', $type->value),
755
                array_filter(SpacecraftModuleTypeEnum::cases(), fn(SpacecraftModuleTypeEnum $type): bool => !$type->isSpecialSystemType())
756
            ),
757
            fn(int $value, string $method): int => $value + $this->$method() ? 1 : 0,
758
            0
759
        );
760
    }
761
}
762