Passed
Branch feature/ECO-965-refactoring (c9cdee)
by Andrey
06:34 queued 01:51
created

IpnRequestAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getIpnRequest() 0 4 1
A __construct() 0 6 1
1
<?php
2
3
/**
4
 * Apache OSL-2
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\AmazonPay\Business\Api\Adapter;
9
10
use PayWithAmazon\IpnHandlerInterface;
11
use SprykerEco\Zed\AmazonPay\Business\Api\Converter\Ipn\IpnConverterInterface;
12
13
class IpnRequestAdapter implements IpnRequestAdapterInterface
14
{
15
    /**
16
     * @var \PayWithAmazon\IpnHandlerInterface
17
     */
18
    protected $ipnHandler;
19
20
    /**
21
     * @var \SprykerEco\Zed\AmazonPay\Business\Api\Converter\Ipn\IpnConverterInterface
22
     */
23
    protected $ipnArrayConverter;
24
25
    /**
26
     * @param \PayWithAmazon\IpnHandlerInterface $ipnHandler
27
     * @param \SprykerEco\Zed\AmazonPay\Business\Api\Converter\Ipn\IpnConverterInterface $ipnArrayConverter
28
     */
29
    public function __construct(
30
        IpnHandlerInterface $ipnHandler,
31
        IpnConverterInterface $ipnArrayConverter
32
    ) {
33
        $this->ipnHandler = $ipnHandler;
34
        $this->ipnArrayConverter = $ipnArrayConverter;
35
    }
36
37
    /**
38
     * @return \Generated\Shared\Transfer\AmazonpayIpnPaymentRequestTransfer
39
     */
40
    public function getIpnRequest()
41
    {
42
        return $this->ipnArrayConverter->convert(
43
            $this->ipnHandler->toArray()
0 ignored issues
show
Bug introduced by
$this->ipnHandler->toArray() of type PayWithAmazon\response is incompatible with the type array expected by parameter $request of SprykerEco\Zed\AmazonPay...terInterface::convert(). ( Ignorable by Annotation )

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

43
            /** @scrutinizer ignore-type */ $this->ipnHandler->toArray()
Loading history...
44
        );
45
    }
46
}
47