Passed
Push — feature/eco-574/eco-2266-check... ( efd21d )
by Aleksey
08:13
created

AvailablePaymentMethodsStep   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setAvailablePaymentMethodsToQuote() 0 4 1
A getAvailablePaymentMethods() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Yves\Afterpay\AuthorizeWorkflow\Steps;
9
10
use Generated\Shared\Transfer\AfterpayAvailablePaymentMethodsTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ePaymentMethodsTransfer 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 Generated\Shared\Transfer\QuoteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer 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 SprykerEco\Client\Afterpay\AfterpayClientInterface;
13
14
class AvailablePaymentMethodsStep implements AvailablePaymentMethodsStepInterface
15
{
16
    /**
17
     * @var \SprykerEco\Client\Afterpay\AfterpayClientInterface
18
     */
19
    protected $afterpayClient;
20
21
    /**
22
     * @param \SprykerEco\Client\Afterpay\AfterpayClientInterface $afterpayClient
23
     */
24
    public function __construct(AfterpayClientInterface $afterpayClient)
25
    {
26
        $this->afterpayClient = $afterpayClient;
27
    }
28
29
    /**
30
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
31
     *
32
     * @return \Generated\Shared\Transfer\AfterpayAvailablePaymentMethodsTransfer
33
     */
34
    public function getAvailablePaymentMethods(QuoteTransfer $quoteTransfer): AfterpayAvailablePaymentMethodsTransfer
35
    {
36
        $this->setAvailablePaymentMethodsToQuote($quoteTransfer);
37
38
        return $quoteTransfer->getAfterpayAvailablePaymentMethods();
39
    }
40
41
    /**
42
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
43
     *
44
     * @return void
45
     */
46
    protected function setAvailablePaymentMethodsToQuote(QuoteTransfer $quoteTransfer): void
47
    {
48
        $availablePaymentMethods = $this->afterpayClient->getAvailablePaymentMethods($quoteTransfer);
49
        $quoteTransfer->setAfterpayAvailablePaymentMethods($availablePaymentMethods);
50
    }
51
}
52