Issues (220)

src/Resolver/Address/ApplePayAddressResolver.php (2 issues)

Labels
Severity
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * You can find more information about us on https://bitbag.io and write us
7
 * an email on [email protected].
8
 */
9
10
declare(strict_types=1);
11
12
namespace BitBag\SyliusMolliePlugin\Resolver\Address;
13
14
use Sylius\Component\Order\Model\OrderInterface;
15
16
final class ApplePayAddressResolver implements ApplePayAddressResolverInterface
17
{
18
    /** @var AddressResolverInterface */
19
    private $addressResolver;
20
21
    public function __construct(AddressResolverInterface $addressResolver)
22
    {
23
        $this->addressResolver = $addressResolver;
24
    }
25
26
    public function resolve(OrderInterface $order, array $applePayData): void
27
    {
28
        $appleShippingAddress = $this->addressResolver->resolve($applePayData['shippingContact']);
29
        $appleBillingAddress = $this->addressResolver->resolve($applePayData['billingContact']);
30
31
        try {
32
            $order->setShippingAddress($appleShippingAddress);
0 ignored issues
show
The method setShippingAddress() does not exist on Sylius\Component\Order\Model\OrderInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Sylius\Component\Order\Model\Order. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
            $order->/** @scrutinizer ignore-call */ 
33
                    setShippingAddress($appleShippingAddress);
Loading history...
33
            $order->setBillingAddress($appleBillingAddress);
0 ignored issues
show
The method setBillingAddress() does not exist on Sylius\Component\Order\Model\OrderInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Sylius\Component\Order\Model\Order. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
            $order->/** @scrutinizer ignore-call */ 
34
                    setBillingAddress($appleBillingAddress);
Loading history...
34
        } catch (\Exception $e) {
35
            throw new \Exception(\sprintf('Some error with create address to order'));
36
        }
37
    }
38
}
39