Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function visitOrder(Order $order) |
||
26 | { |
||
27 | if (!$order->getShippingMethod() instanceof ShippingMethod) { |
||
28 | $order->setPaymentMethod(null); |
||
29 | |||
30 | return; |
||
31 | } |
||
32 | |||
33 | $shippingMethod = $order->getShippingMethod(); |
||
34 | $paymentMethods = $shippingMethod->getPaymentMethods(); |
||
35 | |||
36 | if (null === $order->getPaymentMethod() || false === $paymentMethods->contains($order->getPaymentMethod())) { |
||
37 | $order->setPaymentMethod($paymentMethods->first()); |
||
38 | } |
||
39 | } |
||
40 | } |
||
41 |