Conditions | 7 |
Paths | 17 |
Total Lines | 55 |
Code Lines | 42 |
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 |
||
87 | public function getPriceDetails() |
||
88 | { |
||
89 | if ($this->price) { |
||
90 | $taxRate = 0; |
||
91 | $priceInc = 0; |
||
92 | $taxValue = 0; |
||
93 | |||
94 | if (isset($this->taxRate->rate)) { |
||
95 | $taxRate = $this->taxRate->rate; |
||
96 | $priceInc = (($this->taxRate->rate / 100) * $this->price) + $this->price; |
||
97 | $taxValue = $priceInc - $this->price; |
||
98 | } |
||
99 | |||
100 | $discountPriceInc = false; |
||
101 | $discountPriceEx = false; |
||
102 | $discountTaxRate = 0; |
||
103 | if ($this->discount_value) { |
||
104 | if ($this->discount_type == 'amount') { |
||
105 | $discountPriceInc = $priceInc - $this->discount_value; |
||
106 | $discountPriceEx = $discountPriceInc / 1.21; |
||
107 | } elseif ($this->discount_type == 'percent') { |
||
108 | $tax = ($this->discount_value / 100) * $priceInc; |
||
109 | $discountPriceInc = $priceInc - $tax; |
||
110 | $discountPriceEx = $discountPriceInc / 1.21; |
||
111 | } |
||
112 | $discountTaxRate = $discountPriceInc - $discountPriceEx; |
||
113 | $discountPriceInc = $discountPriceInc; |
||
114 | $discountPriceEx = $discountPriceEx; |
||
115 | } |
||
116 | |||
117 | $commercialPrice = null; |
||
118 | if ($this->commercial_price) { |
||
119 | $commercialPrice = number_format($this->commercial_price, 2, '.', ''); |
||
120 | } |
||
121 | |||
122 | return array( |
||
123 | 'original_price_ex_tax' => $this->price, |
||
124 | 'original_price_ex_tax_number_format' => number_format($this->price, 2, '.', ''), |
||
125 | 'original_price_inc_tax' => $priceInc, |
||
126 | 'original_price_inc_tax_number_format' => number_format($priceInc, 2, '.', ''), |
||
127 | 'commercial_price_number_format' => $commercialPrice, |
||
128 | 'tax_rate' => $taxRate, |
||
129 | 'tax_value' => $taxValue, |
||
130 | 'currency' => 'EU', |
||
131 | 'discount_price_inc' => $discountPriceInc, |
||
132 | 'discount_price_inc_number_format' => number_format($discountPriceInc, 2, '.', ''), |
||
133 | 'discount_price_ex' => $discountPriceEx, |
||
134 | 'discount_price_ex_number_format' => number_format($discountPriceEx, 2, '.', ''), |
||
135 | 'discount_tax_value' => $discountTaxRate, |
||
136 | 'discount_value' => $this->discount_value, |
||
137 | 'amount' => $this->amount |
||
138 | ); |
||
139 | } |
||
140 | |||
141 | return null; |
||
142 | } |
||
211 |
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