Passed
Push — feature/ECO-807-travis-ci ( 7b7181...a6fc91 )
by Andrey
03:17
created

createOrderAuthFailedSoftDeclineMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
c 1
b 1
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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\Transaction\Notification;
9
10
use Generated\Shared\Transfer\AmazonpayCallTransfer;
11
12
class OrderMessageFactory implements OrderMessageFactoryInterface
13
{
14
15
    /**
16
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonpayCallTransfer
17
     *
18
     * @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\Notification\AbstractNotificationMessage|null
19
     */
20
    public function createFailedAuthMessage(AmazonpayCallTransfer $amazonpayCallTransfer)
21
    {
22
        if ($amazonpayCallTransfer->getAmazonpayPayment()
23
            ->getAuthorizationDetails()
24
            ->getAuthorizationStatus()
25
            ->getIsSuspended()
26
        ) {
27
            return $this->createOrderAuthFailedSoftDeclineMessage($amazonpayCallTransfer);
28
        }
29
30
        if ($amazonpayCallTransfer->getAmazonpayPayment()
31
            ->getAuthorizationDetails()
32
            ->getAuthorizationStatus()
33
            ->getIsDeclined()
34
        ) {
35
            return $this->createOrderAuthFailedHardDeclineMessage($amazonpayCallTransfer);
36
        }
37
38
        return null;
39
    }
40
41
    /**
42
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonpayCallTransfer
43
     *
44
     * @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\Notification\AbstractNotificationMessage
45
     */
46
    protected function createOrderAuthFailedSoftDeclineMessage(AmazonpayCallTransfer $amazonpayCallTransfer)
47
    {
48
        return new OrderAuthFailedSoftDeclineMessage($amazonpayCallTransfer);
0 ignored issues
show
Unused Code introduced by
The call to SprykerEco\Zed\Amazonpay...eMessage::__construct() has too many arguments starting with $amazonpayCallTransfer. ( Ignorable by Annotation )

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

48
        return /** @scrutinizer ignore-call */ new OrderAuthFailedSoftDeclineMessage($amazonpayCallTransfer);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
49
    }
50
51
    /**
52
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonpayCallTransfer
53
     *
54
     * @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\Notification\AbstractNotificationMessage
55
     */
56
    protected function createOrderAuthFailedHardDeclineMessage(AmazonpayCallTransfer $amazonpayCallTransfer)
57
    {
58
        return new OrderAuthFailedHardDeclineMessage($amazonpayCallTransfer);
59
    }
60
61
}
62