Conditions | 1 |
Total Lines | 58 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
58 | public function setUp(): void |
||
59 | { |
||
60 | $this->float_unit = new MeasurementUnit(); |
||
61 | $this->float_unit->setName('float'); |
||
62 | $this->float_unit->setUnit('f'); |
||
63 | $this->float_unit->setIsInteger(false); |
||
64 | $this->float_unit->setUseSIPrefix(true); |
||
65 | |||
66 | //Setup some example parts and part lots |
||
67 | $this->part1 = new Part(); |
||
68 | $this->part1->setName('Part 1'); |
||
69 | $this->lot1a = new class extends PartLot { |
||
70 | public function getID(): ?int |
||
71 | { |
||
72 | return 1; |
||
73 | } |
||
74 | }; |
||
75 | $this->part1->addPartLot($this->lot1a); |
||
76 | $this->lot1a->setAmount(10); |
||
77 | $this->lot1a->setDescription('Lot 1a'); |
||
78 | |||
79 | $this->lot1b = new class extends PartLot { |
||
80 | public function getID(): ?int |
||
81 | { |
||
82 | return 2; |
||
83 | } |
||
84 | }; |
||
85 | $this->part1->addPartLot($this->lot1b); |
||
86 | $this->lot1b->setAmount(20); |
||
87 | $this->lot1b->setDescription('Lot 1b'); |
||
88 | |||
89 | $this->part2 = new Part(); |
||
90 | |||
91 | $this->part2->setName('Part 2'); |
||
92 | $this->part2->setPartUnit($this->float_unit); |
||
93 | $this->lot2 = new PartLot(); |
||
94 | $this->part2->addPartLot($this->lot2); |
||
95 | $this->lot2->setAmount(2.5); |
||
96 | $this->lot2->setDescription('Lot 2'); |
||
97 | |||
98 | $this->bom_entry1a = new ProjectBOMEntry(); |
||
99 | $this->bom_entry1a->setPart($this->part1); |
||
100 | $this->bom_entry1a->setQuantity(2); |
||
101 | |||
102 | $this->bom_entry1b = new ProjectBOMEntry(); |
||
103 | $this->bom_entry1b->setPart($this->part2); |
||
104 | $this->bom_entry1b->setQuantity(1.5); |
||
105 | |||
106 | $this->bom_entry1c = new ProjectBOMEntry(); |
||
107 | $this->bom_entry1c->setName('Non-part BOM entry'); |
||
108 | $this->bom_entry1c->setQuantity(4); |
||
109 | |||
110 | |||
111 | $this->project1 = new Project(); |
||
112 | $this->project1->setName('Project 1'); |
||
113 | $this->project1->addBomEntry($this->bom_entry1a); |
||
114 | $this->project1->addBomEntry($this->bom_entry1b); |
||
115 | $this->project1->addBomEntry($this->bom_entry1c); |
||
116 | } |
||
178 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths