| Conditions | 17 | 
| Paths | 128 | 
| Total Lines | 57 | 
| Code Lines | 31 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 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 | ||
| 187 | public function generatePulldowns($product, $productAttributeId, $attributeLeadingGroup = false, $secondAttributeId = false) | ||
| 188 |     { | ||
| 189 | $defaultOption = array(); | ||
| 190 | $check = array(); | ||
| 191 | |||
| 192 | //create all pulldowns | ||
| 193 |         foreach ($product->attributes as $row) { | ||
| 194 |             if ($row['combinations']) { | ||
| 195 |                 foreach ($row['combinations'] as $key => $value) { | ||
| 196 | $newPullDowns[$value->attribute->attributeGroup->title][$value->attribute->id] = $value->attribute->value; | ||
| 197 | } | ||
| 198 | } | ||
| 199 | } | ||
| 200 | |||
| 201 |         if(!$productAttributeId AND $attributeLeadingGroup AND isset($newPullDowns[$attributeLeadingGroup->title])) { | ||
| 202 | $productAttributeId = key($newPullDowns[$attributeLeadingGroup->title]); | ||
| 203 | } | ||
| 204 | |||
| 205 | $productAttributeResultWithAttributeId = $this->repo->getProductAttribute($product, $productAttributeId); | ||
| 206 | |||
| 207 |         if ($productAttributeResultWithAttributeId->get()->first()) { | ||
| 208 |             foreach ($productAttributeResultWithAttributeId->get()->first()->combinations as $combination) { | ||
| 209 | $defaultOption[$combination->attribute->attributeGroup->title][$combination->attribute->id] = $combination->attribute->value; | ||
| 210 | } | ||
| 211 |         } else { | ||
| 212 | $productAttributeId = false; | ||
| 213 | } | ||
| 214 | |||
| 215 | $productAttributeResultWithAttributeId = $productAttributeResultWithAttributeId->get(); | ||
| 216 | |||
| 217 |         if ($productAttributeResultWithAttributeId) { | ||
| 218 | |||
| 219 |             foreach ($productAttributeResultWithAttributeId as $row) { | ||
| 220 |                 if ($row['combinations']) { | ||
| 221 |                     foreach ($row['combinations'] as $key => $value) { | ||
| 222 | $defaultOption[$value->attribute->attributeGroup->title][$value->attribute->id] = $value->attribute->value; | ||
| 223 | } | ||
| 224 | } | ||
| 225 | } | ||
| 226 | } | ||
| 227 | |||
| 228 | $defaultPulldown = array(); | ||
| 229 |         if ($attributeLeadingGroup AND isset($newPullDowns[$attributeLeadingGroup->title])) { | ||
| 230 | $defaultOption[$attributeLeadingGroup->title] = $newPullDowns[$attributeLeadingGroup->title]; | ||
| 231 | $newPullDowns = $defaultOption; | ||
| 232 | } | ||
| 233 | |||
| 234 |         if ($attributeLeadingGroup AND isset($defaultOption[$attributeLeadingGroup->title])) { | ||
| 235 | $defaultPulldown = $newPullDowns[$attributeLeadingGroup->title]; | ||
| 236 | $defaultPulldownFirstKey = key($newPullDowns[$attributeLeadingGroup->title]); | ||
| 237 | unset($newPullDowns[$attributeLeadingGroup->title]); | ||
| 238 | $newPullDowns = array_merge(array($attributeLeadingGroup->title => $defaultPulldown), $newPullDowns); | ||
| 239 | } | ||
| 240 | |||
| 241 | $productAttribute = $this->repo->getProductAttribute($product, $productAttributeId, $secondAttributeId)->first(); | ||
| 242 | |||
| 243 |         return array('productAttribute' => $productAttribute, 'productAttributeId' => $productAttributeId, 'defaultOption' => $defaultOption, 'newPullDowns' => $newPullDowns); | ||
| 244 | } | ||
| 247 | } | 
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