Conditions | 15 |
Paths | 11 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
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 |
||
64 | public function aroundCheck(OrigState $subject, callable $proceed, Order $order) { |
||
65 | if (version_compare($this->shopHelper->getMagentoVersion(), '2.3.0', '<=') || !$order->getPayment()->getMethodInstance() instanceof PayoneMethod) { |
||
66 | return $proceed($order); |
||
67 | } |
||
68 | |||
69 | $currentState = $order->getState(); |
||
70 | if ($currentState == Order::STATE_NEW && $order->getIsInProcess()) { |
||
71 | $order->setState(Order::STATE_PROCESSING)->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_PROCESSING)); |
||
72 | $currentState = Order::STATE_PROCESSING; |
||
73 | } |
||
74 | |||
75 | if (!$order->isCanceled() && !$order->canUnhold() && !$order->canInvoice()) { |
||
76 | // Virtual orders were being falsely set to closed here for authorization orders when the appointed status arrived because canCreditmemo is faulty in Mage 2.3.1 - 2.3.5 |
||
77 | // and because canShip will return false when the order is virtual therefore setStatus(Closed) was removed here for virtual orders |
||
78 | // PLUS: Authorization orders where shipment was created before invoice was paid were falsely set to CLOSED status |
||
79 | if (in_array($currentState, [Order::STATE_PROCESSING, Order::STATE_COMPLETE]) && !$order->canCreditmemo() && !$order->canShip() && !$order->getIsVirtual()) { |
||
80 | if ($order->getTotalDue() == 0) { |
||
81 | $order->setState(Order::STATE_CLOSED)->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_CLOSED)); |
||
82 | } |
||
83 | } elseif ($currentState === Order::STATE_PROCESSING && !$order->canShip()) { |
||
84 | $order->setState(Order::STATE_COMPLETE)->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_COMPLETE)); |
||
85 | } |
||
86 | } |
||
87 | |||
88 | return $subject; |
||
89 | } |
||
91 |
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