| Conditions | 12 | 
| Paths | 37 | 
| Total Lines | 47 | 
| Code Lines | 28 | 
| 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  | 
            ||
| 83 | public function fetchprice(HTTPRequest $request)  | 
            ||
| 84 |     { | 
            ||
| 85 |         if (!$id = $request->getVar('h:product_id')) { | 
            ||
| 86 | return;  | 
            ||
| 87 | }  | 
            ||
| 88 | |||
| 89 |         if (!$product = Product::get()->byID(explode('||', $id)[0])) { | 
            ||
| 90 | return;  | 
            ||
| 91 | }  | 
            ||
| 92 | |||
| 93 |         $quantity = (int)$request->getVar('quantity'); | 
            ||
| 94 | |||
| 95 | $cost = $product->Price * $quantity;  | 
            ||
| 96 | |||
| 97 | $optionsQuery = $this->getOptionsQuery($request->getVars());  | 
            ||
| 98 | |||
| 99 | $options = $product->Options()->filter($optionsQuery);  | 
            ||
| 100 | |||
| 101 |         foreach ($options as $option) { | 
            ||
| 102 |             switch ($option->PriceModifierAction) { | 
            ||
| 103 | case 'Add':  | 
            ||
| 104 | $cost += ($option->PriceModifier * $quantity);  | 
            ||
| 105 | break;  | 
            ||
| 106 | case 'Subtract':  | 
            ||
| 107 | $cost -= ($option->PriceModifier * $quantity);  | 
            ||
| 108 | break;  | 
            ||
| 109 | case 'Set':  | 
            ||
| 110 | $cost = ($option->PriceModifier * $quantity);  | 
            ||
| 111 | break;  | 
            ||
| 112 | }  | 
            ||
| 113 | }  | 
            ||
| 114 | |||
| 115 | $discount = $this->getDiscount($quantity);  | 
            ||
| 116 | |||
| 117 |         if ($discount instanceof DiscountTier && $discount->exists()) { | 
            ||
| 118 |             if ($discount->Discount()->Type == 'Percent') { | 
            ||
| 119 | $discountAmount = $cost * ($discount->Percentage / 100);  | 
            ||
| 120 |             } elseif ($discount->Discount()->Type == 'Amount') { | 
            ||
| 121 | $discountAmount = $discount->Amount;  | 
            ||
| 122 | }  | 
            ||
| 123 | |||
| 124 |             if (isset($discountAmount)) { | 
            ||
| 125 | $cost = $cost - $discountAmount;  | 
            ||
| 126 | }  | 
            ||
| 127 | }  | 
            ||
| 128 | |||
| 129 | return $cost;  | 
            ||
| 130 | }  | 
            ||
| 163 | 
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