Conditions | 6 |
Paths | 9 |
Total Lines | 54 |
Code Lines | 33 |
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 |
||
113 | public function build(array $buildSubject) |
||
114 | { |
||
115 | $paymentDO = $this->subjectReader->readPayment($buildSubject); |
||
116 | $payment = $paymentDO->getPayment(); |
||
117 | |||
118 | $result = []; |
||
119 | |||
120 | $orderAdapter = $this->orderAdapterFactory->create( |
||
121 | ['order' => $payment->getOrder()] |
||
122 | ); |
||
123 | |||
124 | $order = $paymentDO->getOrder(); |
||
125 | |||
126 | $storeId = $order->getStoreId(); |
||
127 | $useSplit = $this->config->getSplitValue('use_split', $storeId); |
||
128 | if (!$useSplit) { |
||
129 | return $result; |
||
130 | } |
||
131 | |||
132 | $addition = $orderAdapter->getTaxAmount(); |
||
133 | $interest = $orderAdapter->getBaseMoipInterestAmount(); |
||
134 | $grandTotal = $order->getGrandTotalAmount(); |
||
135 | $total = $grandTotal; |
||
136 | |||
137 | $secondaryMPA = $this->config->getSplitValue('secondary_mpa', $storeId); |
||
138 | $secondaryPercent = $this->config->getSplitValue('secondary_percent', $storeId); |
||
139 | $commiUseShipping = $this->config->getSplitValue('secondary_percent_include_shipping', $storeId); |
||
140 | $commiUseInterest = $this->config->getSplitValue('secondary_percent_include_interest', $storeId); |
||
141 | |||
142 | if (!$commiUseInterest) { |
||
143 | if($interest > 0) { |
||
144 | $total = $grandTotal - $interest; |
||
145 | } elseif ($interest < 0) { |
||
146 | $total = $grandTotal + $interest; |
||
147 | } |
||
148 | } |
||
149 | |||
150 | if (!$commiUseShipping) { |
||
151 | $total = $total - $orderAdapter->getShippingAmount(); |
||
152 | } |
||
153 | |||
154 | $commission = $total * ($secondaryPercent / 100); |
||
155 | |||
156 | $result[self::RECEIVERS][] = [ |
||
157 | self::RECEIVERS_MOIP_ACCOUNT => [ |
||
158 | self::RECEIVERS_MOIP_ACCOUNT_ID => $secondaryMPA, |
||
159 | ], |
||
160 | self::RECEIVERS_TYPE => self::RECEIVERS_TYPE_SECONDARY, |
||
161 | self::RECEIVERS_AMOUNT => [ |
||
162 | self::RECEIVERS_TYPE_FIXED => $this->config->formatPrice(round($commission, 2)), |
||
163 | ], |
||
164 | ]; |
||
165 | |||
166 | return $result; |
||
167 | } |
||
169 |
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