Passed
Pull Request — master (#4)
by Andrey
06:53 queued 03:48
created

IpnRequestLogger::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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\Payment\Handler\Ipn\Logger;
9
10
use Orm\Zed\Amazonpay\Persistence\SpyPaymentAmazonpay;
1 ignored issue
show
Bug introduced by
The type Orm\Zed\Amazonpay\Persistence\SpyPaymentAmazonpay was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Orm\Zed\Amazonpay\Persistence\SpyPaymentAmazonpayIpnLog;
1 ignored issue
show
Bug introduced by
The type Orm\Zed\Amazonpay\Persis...yPaymentAmazonpayIpnLog was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
13
use SprykerEco\Zed\Amazonpay\Dependency\Facade\AmazonpayToUtilEncodingInterface;
14
15
class IpnRequestLogger implements IpnRequestLoggerInterface
16
{
17
18
    /**
19
     * @var \SprykerEco\Zed\Amazonpay\Dependency\Facade\AmazonpayToUtilEncodingInterface
20
     */
21
    protected $utilEncoding;
22
23
    /**
24
     * @param \SprykerEco\Zed\Amazonpay\Dependency\Facade\AmazonpayToUtilEncodingInterface $utilEncoding
25
     */
26
    public function __construct(AmazonpayToUtilEncodingInterface $utilEncoding)
27
    {
28
        $this->utilEncoding = $utilEncoding;
29
    }
30
31
    /**
32
     * @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer $ipnRequest
33
     * @param \Orm\Zed\Amazonpay\Persistence\SpyPaymentAmazonpay $paymentAmazonpay
34
     *
35
     * @return void
36
     */
37
    public function log(AbstractTransfer $ipnRequest, SpyPaymentAmazonpay $paymentAmazonpay)
38
    {
39
        $ipnLog = new SpyPaymentAmazonpayIpnLog();
40
41
        $ipnLog->setMessage($this->utilEncoding->encodeJson($ipnRequest->toArray()));
42
        $ipnLog->setMessageId($ipnRequest->getMessage()->getMessageId());
0 ignored issues
show
Bug introduced by
The method getMessage() does not exist on Spryker\Shared\Kernel\Transfer\AbstractTransfer. It seems like you code against a sub-type of Spryker\Shared\Kernel\Transfer\AbstractTransfer such as Generated\Shared\Transfe...uthorizeRequestTransfer or Generated\Shared\Transfer\CustomerErrorTransfer or Generated\Shared\Transfer\CheckoutErrorTransfer or Generated\Shared\Transfer\CustomerTransfer or Generated\Shared\Transfe...ntRefundRequestTransfer or Generated\Shared\Transfe...tCaptureRequestTransfer or Generated\Shared\Transfer\CommentTransfer or Generated\Shared\Transfe...ResponseMessageTransfer or Generated\Shared\Transfe...nceNotificationTransfer. ( Ignorable by Annotation )

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

42
        $ipnLog->setMessageId($ipnRequest->/** @scrutinizer ignore-call */ getMessage()->getMessageId());
Loading history...
43
        $ipnLog->setFkPaymentAmazonpay($paymentAmazonpay->getIdPaymentAmazonpay());
44
        $ipnLog->save();
45
    }
46
47
}
48