Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function setCustomerAddressing(GenericEvent $event) |
||
30 | { |
||
31 | $order = $event->getSubject(); |
||
32 | |||
33 | if (!$order instanceof OrderInterface) { |
||
34 | throw new UnexpectedTypeException( |
||
35 | $order, |
||
36 | OrderInterface::class |
||
37 | ); |
||
38 | } |
||
39 | |||
40 | /** @var CustomerInterface $customer */ |
||
41 | if (null === $customer = $order->getCustomer()) { |
||
42 | return; |
||
43 | } |
||
44 | |||
45 | if (null === $customer->getDefaultAddress()) { |
||
46 | $customer->setDefaultAddress(clone $order->getShippingAddress()); |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 |