Passed
Branch feature/ECO-573-per-item-proce... (fe5bf4)
by Andrey
04:56
created

IpnRequestAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getIpnRequest() 0 4 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\ArrayConverterInterface;
12
13
class IpnRequestAdapter implements IpnRequestAdapterInterface
14
{
15
16
    /**
17
     * @var \PayWithAmazon\IpnHandlerInterface
18
     */
19
    protected $ipnHandler;
20
21
    /**
22
     * @var \SprykerEco\Zed\Amazonpay\Business\Api\Converter\ArrayConverterInterface
23
     */
24
    protected $ipnArrayConverter;
25
26
    /**
27
     * @param \PayWithAmazon\IpnHandlerInterface $ipnHandler
28
     * @param \SprykerEco\Zed\Amazonpay\Business\Api\Converter\ArrayConverterInterface $ipnArrayConverter
29
     */
30
    public function __construct(
31
        IpnHandlerInterface $ipnHandler,
32
        ArrayConverterInterface $ipnArrayConverter
33
    ) {
34
        $this->ipnHandler = $ipnHandler;
35
        $this->ipnArrayConverter = $ipnArrayConverter;
36
    }
37
38
    /**
39
     * @return \Spryker\Shared\Kernel\Transfer\AbstractTransfer
40
     */
41
    public function getIpnRequest()
42
    {
43
        return $this->ipnArrayConverter->convert(
44
            $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 $data 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

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