| Conditions | 1 |
| Paths | 1 |
| Total Lines | 95 |
| Code Lines | 68 |
| 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 |
||
| 95 | protected function getDatas(): array |
||
| 96 | { |
||
| 97 | /** |
||
| 98 | * Supplier references |
||
| 99 | */ |
||
| 100 | $davigel = $this->getReference('supplier1'); |
||
| 101 | $davifrais = $this->getReference('supplier2'); |
||
| 102 | $davisec = $this->getReference('supplier3'); |
||
| 103 | $loireBoissons = $this->getReference('supplier4'); |
||
| 104 | |||
| 105 | /** |
||
| 106 | * Categories references |
||
| 107 | */ |
||
| 108 | $frais = $this->getReference('family-log4'); |
||
| 109 | $sec = $this->getReference('family-log5'); |
||
| 110 | $viandeSurgele = $this->getReference('family-log9'); |
||
| 111 | $fruitLegumesFrais = $this->getReference('family-log10'); |
||
| 112 | $vins = $this->getReference('family-log16'); |
||
| 113 | |||
| 114 | /** |
||
| 115 | * Storage area references |
||
| 116 | */ |
||
| 117 | $zoneSurgele = $this->getReference('zoneStorage1'); |
||
| 118 | $zoneFrais = $this->getReference('zoneStorage2'); |
||
| 119 | $zoneSec = $this->getReference('zoneStorage3'); |
||
| 120 | $zoneBoisson = $this->getReference('zoneStorage4'); |
||
| 121 | |||
| 122 | /** |
||
| 123 | * Units references |
||
| 124 | */ |
||
| 125 | $bouteille = $this->getReference('unit2'); |
||
| 126 | $kilogramme = $this->getReference('unit5'); |
||
| 127 | $piece = $this->getReference('unit7'); |
||
| 128 | |||
| 129 | /** |
||
| 130 | * VAT references |
||
| 131 | */ |
||
| 132 | $tvaReduit = $this->getReference('tva1'); |
||
| 133 | |||
| 134 | /** |
||
| 135 | * Articles datas |
||
| 136 | */ |
||
| 137 | $datas = [ |
||
| 138 | ['name' => 'Salade', 'supplier' => $davifrais, |
||
| 139 | 'familyLog' => $fruitLegumesFrais, 'zoneStorage' => $zoneFrais, |
||
| 140 | 'unitStorage' => $piece, 'unitWorking' => $kilogramme, 'price' => $this->getRandFloat(0, 12, 3), |
||
| 141 | 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 142 | ['name' => 'Bavette 150gr', 'supplier' => $davigel, |
||
| 143 | 'familyLog' => $viandeSurgele, 'zoneStorage' => $zoneSurgele, |
||
| 144 | 'unitStorage' => $piece, 'unitWorking' => $piece, 'price' => $this->getRandFloat(0, 12, 3), |
||
| 145 | 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 146 | ['name' => 'Baguettine', 'supplier' => $davigel, |
||
| 147 | 'familyLog' => $viandeSurgele, 'zoneStorage' => $zoneSurgele, |
||
| 148 | 'unitStorage' => $piece, 'unitWorking' => $piece, 'price' => $this->getRandFloat(0, 12, 3), |
||
| 149 | 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 150 | ['name' => 'Steack haché 20%MG 120g', 'supplier' => $davigel, |
||
| 151 | 'familyLog' => $viandeSurgele, 'zoneStorage' => $zoneSurgele, |
||
| 152 | 'unitStorage' => $piece, 'unitWorking' => $piece, 'price' => $this->getRandFloat(0, 12, 3), |
||
| 153 | 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 154 | ['name' => 'Ananas poche 2.3 KG', 'supplier' => $davisec, |
||
| 155 | 'familyLog' => $sec, 'zoneStorage' => $zoneSec, |
||
| 156 | 'unitStorage' => $piece, 'unitWorking' => $kilogramme, 'price' => $this->getRandFloat(0, 12, 3), |
||
| 157 | 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 158 | ['name' => 'Appareil Champigons 2 KG', 'supplier' => $davifrais, |
||
| 159 | 'familyLog' => $frais, 'zoneStorage' => $zoneFrais, |
||
| 160 | 'unitStorage' => $piece, 'unitWorking' => $kilogramme, 'price' => $this->getRandFloat(0, 12, 3), |
||
| 161 | 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 162 | ['name' => 'Bacon tranche Barq 88G', 'supplier' => $davifrais, |
||
| 163 | 'familyLog' => $frais, 'zoneStorage' => $zoneFrais, |
||
| 164 | 'unitStorage' => $piece, 'unitWorking' => $kilogramme, 'price' => $this->getRandFloat(0, 12, 3), |
||
| 165 | 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 166 | ['name' => 'Beurre doux 8Gx125', 'supplier' => $davifrais, |
||
| 167 | 'familyLog' => $frais, 'zoneStorage' => $zoneFrais, |
||
| 168 | 'unitStorage' => $kilogramme, 'unitWorking' => $piece, 'price' => $this->getRandFloat(0, 12, 3), |
||
| 169 | 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 170 | ['name' => 'Boule pour oeuf neige', 'supplier' => $davifrais, |
||
| 171 | 'familyLog' => $frais, 'zoneStorage' => $zoneFrais, |
||
| 172 | 'unitStorage' => $piece, 'unitWorking' => $piece, 'price' => $this->getRandFloat(0, 12, 3), |
||
| 173 | 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 174 | ['name' => 'Champignons émincé 500G', 'supplier' => $davifrais, |
||
| 175 | 'familyLog' => $fruitLegumesFrais, 'zoneStorage' => $zoneFrais, |
||
| 176 | 'unitStorage' => $kilogramme, 'unitWorking' => $kilogramme, |
||
| 177 | 'price' => $this->getRandFloat(0, 12, 3), 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, |
||
| 178 | 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 179 | ['name' => 'Chorizo prétr. 500G', 'supplier' => $davifrais, |
||
| 180 | 'familyLog' => $fruitLegumesFrais, 'zoneStorage' => $zoneFrais, |
||
| 181 | 'unitStorage' => $kilogramme, 'unitWorking' => $kilogramme, |
||
| 182 | 'price' => $this->getRandFloat(0, 12, 3), 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 183 | ['name' => 'V.RG Bourgueil 75cl', 'supplier' => $loireBoissons, |
||
| 184 | 'familyLog' => $vins, 'zoneStorage' => $zoneBoisson, |
||
| 185 | 'unitStorage' => $bouteille, 'unitWorking' => $bouteille, |
||
| 186 | 'price' => 5.11, 'packaging' => $this->getRandFloat(5, 125, 3), 'tva' => $tvaReduit, 'minStock' => $this->getRandFloat(3, 25, 3), ], |
||
| 187 | ]; |
||
| 188 | |||
| 189 | return $datas; |
||
| 190 | } |
||
| 192 |