| Conditions | 10 | 
| Paths | 62 | 
| Total Lines | 102 | 
| Code Lines | 52 | 
| 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  | 
            ||
| 123 | protected function getProductFields(FieldList $fields)  | 
            ||
| 124 |     { | 
            ||
| 125 | $hiddenTitle = ($this->product->ReceiptTitle) ?  | 
            ||
| 126 | htmlspecialchars($this->product->ReceiptTitle) :  | 
            ||
| 127 | htmlspecialchars($this->product->Title);  | 
            ||
| 128 | $code = $this->product->Code;  | 
            ||
| 129 | |||
| 130 |         if ($this->product->isAvailable()) { | 
            ||
| 131 | $fields->push(  | 
            ||
| 132 |                 HiddenField::create('name') | 
            ||
| 133 | ->setValue(  | 
            ||
| 134 | Foxy::getGeneratedValue($code, 'name', $hiddenTitle, 'value')  | 
            ||
| 135 | )  | 
            ||
| 136 | );  | 
            ||
| 137 | |||
| 138 | $fields->push(  | 
            ||
| 139 |                 HiddenField::create('category') | 
            ||
| 140 | ->setValue(  | 
            ||
| 141 | Foxy::getGeneratedValue($code, 'category', $this->product->FoxyCategory()->Code, 'value')  | 
            ||
| 142 | )  | 
            ||
| 143 | );  | 
            ||
| 144 | |||
| 145 | $fields->push(  | 
            ||
| 146 |                 HiddenField::create('code') | 
            ||
| 147 | ->setValue(  | 
            ||
| 148 | Foxy::getGeneratedValue($code, 'code', $this->product->Code, 'value')  | 
            ||
| 149 | )  | 
            ||
| 150 | );  | 
            ||
| 151 | |||
| 152 | $fields->push(  | 
            ||
| 153 |                 HiddenField::create('product_id') | 
            ||
| 154 | ->setValue(  | 
            ||
| 155 | Foxy::getGeneratedValue($code, 'product_id', $this->product->ID, 'value')  | 
            ||
| 156 | )  | 
            ||
| 157 | );  | 
            ||
| 158 | |||
| 159 | $fields->push(  | 
            ||
| 160 |                 HiddenField::create('price') | 
            ||
| 161 | ->setValue(  | 
            ||
| 162 | Foxy::getGeneratedValue($code, 'price', $this->product->Price, 'value')  | 
            ||
| 163 | )  | 
            ||
| 164 | );  | 
            ||
| 165 | |||
| 166 |             if ($this->product->hasExtension(Shippable::class)) { | 
            ||
| 167 |                 if ($this->product->Weight > 0) { | 
            ||
| 168 | $fields->push(  | 
            ||
| 169 |                         HiddenField::create('weight') | 
            ||
| 170 | ->setValue(  | 
            ||
| 171 | Foxy::getGeneratedValue($code, 'weight', $this->product->Weight, 'value')  | 
            ||
| 172 | )  | 
            ||
| 173 | );  | 
            ||
| 174 | }  | 
            ||
| 175 | }  | 
            ||
| 176 | |||
| 177 | $image = null;  | 
            ||
| 178 |             if (method_exists($this->product, 'getImage')) { | 
            ||
| 179 |                 if ($this->product->getImage()) { | 
            ||
| 180 | $image = $this->product->getImage()->CMSThumbnail()->absoluteURL;  | 
            ||
| 181 | }  | 
            ||
| 182 |                 if ($image) { | 
            ||
| 183 | $fields->push(  | 
            ||
| 184 |                         HiddenField::create('image') | 
            ||
| 185 | ->setValue(  | 
            ||
| 186 | Foxy::getGeneratedValue($code, 'image', $image, 'value')  | 
            ||
| 187 | )  | 
            ||
| 188 | );  | 
            ||
| 189 | }  | 
            ||
| 190 | }  | 
            ||
| 191 | |||
| 192 | |||
| 193 | /*  | 
            ||
| 194 | // TODO: revisit after product options are implemented  | 
            ||
| 195 | $optionsSet = $this->getProductOptionSet();  | 
            ||
| 196 | $fields->push($optionsSet);  | 
            ||
| 197 | $quantityMax = ($this->site_config->MaxQuantity) ? $this->site_config->MaxQuantity : 10;  | 
            ||
| 198 |             $fields->push(QuantityField::create('x:visibleQuantity')->setTitle('Quantity')->setValue(1)); | 
            ||
| 199 | $fields->push(  | 
            ||
| 200 |                 HiddenField::create('quantity') | 
            ||
| 201 | ->setValue(  | 
            ||
| 202 | Foxy::getGeneratedValue($code, 'quantity', 1, 'value')  | 
            ||
| 203 | )  | 
            ||
| 204 | );  | 
            ||
| 205 | */  | 
            ||
| 206 | |||
| 207 | $fields->push(  | 
            ||
| 208 |                 HeaderField::create('submitPrice', '$' . $this->product->Price, 4) | 
            ||
| 209 |                     ->addExtraClass('submit-price') | 
            ||
| 210 | );  | 
            ||
| 211 | $fields->push(  | 
            ||
| 212 |                 $unavailable = HeaderField::create('unavailableText', 'Selection unavailable', 4) | 
            ||
| 213 |                     ->addExtraClass('unavailable-text') | 
            ||
| 214 | );  | 
            ||
| 215 |             if (!empty(trim($this->foxy_setting->StoreDomain)) && $this->product->isAvailable()) { | 
            ||
| 216 |                 $unavailable->addExtraClass('hidden'); | 
            ||
| 217 | }  | 
            ||
| 218 | |||
| 219 |             $this->extend('updateProductFields', $fields); | 
            ||
| 220 |         } else { | 
            ||
| 221 |             $fields->push(HeaderField::create('unavailableText', 'currently unavaiable', 4)); | 
            ||
| 222 | }  | 
            ||
| 223 | |||
| 224 | return $fields;  | 
            ||
| 225 | }  | 
            ||
| 250 | 
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