Completed
Push — dev ( f11eba...1182bc )
by Andrey
11s
created

AbstractTransactionCollection   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A executeHandlers() 0 14 4
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;
9
10
use Generated\Shared\Transfer\AmazonpayCallTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfer\AmazonpayCallTransfer 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
12
abstract class AbstractTransactionCollection
13
{
14
    /**
15
     * @var \SprykerEco\Zed\AmazonPay\Business\Payment\Handler\Transaction\AmazonpayTransactionInterface[]
16
     */
17
    protected $transactionHandlers;
18
19
    /**
20
     * @param \SprykerEco\Zed\AmazonPay\Business\Payment\Handler\Transaction\AmazonpayTransactionInterface[] $transactionHandlers
21
     */
22
    public function __construct(
23
        array $transactionHandlers
24
    ) {
25
        $this->transactionHandlers = $transactionHandlers;
26
    }
27
28
    /**
29
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonPayCallTransfer
30
     *
31
     * @return \Generated\Shared\Transfer\AmazonpayCallTransfer
32
     */
33
    protected function executeHandlers(AmazonpayCallTransfer $amazonPayCallTransfer)
34
    {
35
        $amazonPayCallTransfer->getAmazonpayPayment()->setResponseHeader(null);
36
37
        foreach ($this->transactionHandlers as $transactionHandler) {
38
            $amazonPayCallTransfer = $transactionHandler->execute($amazonPayCallTransfer);
39
40
            if ($amazonPayCallTransfer->getAmazonpayPayment()->getResponseHeader() &&
41
                !$amazonPayCallTransfer->getAmazonpayPayment()->getResponseHeader()->getIsSuccess()) {
42
                break;
43
            }
44
        }
45
46
        return $amazonPayCallTransfer;
47
    }
48
}
49