| Conditions | 6 | 
| Paths | 10 | 
| Total Lines | 54 | 
| Code Lines | 37 | 
| 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  | 
            ||
| 112 | protected function getProductFields(FieldList $fields)  | 
            ||
| 113 |     { | 
            ||
| 114 | $hiddenTitle = ($this->product->ReceiptTitle) ? htmlspecialchars($this->product->ReceiptTitle) : htmlspecialchars($this->product->Title);  | 
            ||
| 115 | $code = $this->product->Code;  | 
            ||
| 116 | |||
| 117 |         if ($this->product->Available) { | 
            ||
| 118 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'name',  | 
            ||
| 119 | $hiddenTitle))->setValue($hiddenTitle));  | 
            ||
| 120 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'category',  | 
            ||
| 121 | $this->product->Category()->Code))->setValue($this->product->Category()->Code));  | 
            ||
| 122 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'code',  | 
            ||
| 123 | $this->product->Code))->setValue($this->product->Code));  | 
            ||
| 124 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'product_id',  | 
            ||
| 125 | $this->product->ID))->setValue($this->product->ID));  | 
            ||
| 126 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'price',  | 
            ||
| 127 | $this->product->Price))->setValue($this->product->Price));//can't override id  | 
            ||
| 128 | $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'weight',  | 
            ||
| 129 | $this->product->Weight))->setValue($this->product->Weight));  | 
            ||
| 130 | |||
| 131 | |||
| 132 | |||
| 133 |             if ($this->product->PreviewImage()->exists()) { | 
            ||
| 134 | $fields->push(  | 
            ||
| 135 | HiddenField::create(ProductPage::getGeneratedValue($code, 'image',  | 
            ||
| 136 | $this->product->PreviewImage()->PaddedImage(80, 80)->absoluteURL))  | 
            ||
| 137 | ->setValue($this->product->PreviewImage()->PaddedImage(80, 80)->absoluteURL)  | 
            ||
| 138 | );  | 
            ||
| 139 | }  | 
            ||
| 140 | |||
| 141 | $optionsSet = $this->getProductOptionSet();  | 
            ||
| 142 | $fields->push($optionsSet);  | 
            ||
| 143 | |||
| 144 | $quantityMax = ($this->site_config->MaxQuantity) ? $this->site_config->MaxQuantity : 10;  | 
            ||
| 145 | $count = 1;  | 
            ||
| 146 | $quantity = array();  | 
            ||
| 147 |             while ($count <= $quantityMax) { | 
            ||
| 148 | $countVal = ProductPage::getGeneratedValue($this->product->Code, 'quantity', $count, 'value');  | 
            ||
| 149 | $quantity[$countVal] = $count;  | 
            ||
| 150 | $count++;  | 
            ||
| 151 | }  | 
            ||
| 152 | |||
| 153 |             $fields->push(DropdownField::create('quantity', 'Quantity', $quantity)); | 
            ||
| 154 | |||
| 155 |             $fields->push(HeaderField::create('submitPrice', '$' . $this->product->Price, 4)->addExtraClass('submit-price')); | 
            ||
| 156 |             $fields->push(HeaderField::create('unavailableText', 'Selection unavailable', 4)->addExtraClass('hidden unavailable-text')); | 
            ||
| 157 | |||
| 158 |             $this->extend('updatePurchaseFormFields', $fields); | 
            ||
| 159 |         } else { | 
            ||
| 160 |             $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock'), 4); | 
            ||
| 161 | }  | 
            ||
| 162 | |||
| 163 |         $this->extend('updateFoxyStripePurchaseFormFields', $fields); | 
            ||
| 164 | |||
| 165 | return $fields;  | 
            ||
| 166 | }  | 
            ||
| 235 | }  | 
            
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