Completed
Push — feature/eco-1539-heidelpay-eas... ( d0263f...a6169c )
by Ruslan
05:09 queued 05:01
created

EasyCreditDataProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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\Heidelpay\Form\DataProvider;
9
10
use Generated\Shared\Transfer\HeidelpayEasyCreditPaymentTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...syCreditPaymentTransfer 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\PaymentTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentTransfer 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 Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface;
14
use SprykerEco\Yves\Heidelpay\Form\EasyCreditSubForm;
15
use SprykerEco\Yves\Heidelpay\HeidelpayConfig;
16
17
class EasyCreditDataProvider implements StepEngineFormDataProviderInterface
18
{
19
    /**
20
     * @var \SprykerEco\Yves\Heidelpay\HeidelpayConfig
21
     */
22
    protected $heidelPayConfig;
23
24
    /**
25
     * @param \SprykerEco\Yves\Heidelpay\HeidelpayConfig $heidelPayConfig
26
     */
27
    public function __construct(HeidelpayConfig $heidelPayConfig)
28
    {
29
        $this->heidelPayConfig = $heidelPayConfig;
30
    }
31
32
    /**
33
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
1 ignored issue
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...
34
     *
35
     * @return \Generated\Shared\Transfer\QuoteTransfer
36
     */
37
    public function getData(AbstractTransfer $quoteTransfer)
38
    {
39
        if ($quoteTransfer->getPayment() === null) {
0 ignored issues
show
Bug introduced by
The method getPayment() does not exist on Spryker\Shared\Kernel\Transfer\AbstractTransfer. ( Ignorable by Annotation )

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

39
        if ($quoteTransfer->/** @scrutinizer ignore-call */ getPayment() === null) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
            $paymentTransfer = new PaymentTransfer();
41
            $paymentTransfer->setHeidelpayEasyCredit(new HeidelpayEasyCreditPaymentTransfer());
42
            $quoteTransfer->setPayment($paymentTransfer);
0 ignored issues
show
Bug introduced by
The method setPayment() does not exist on Spryker\Shared\Kernel\Transfer\AbstractTransfer. ( Ignorable by Annotation )

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

42
            $quoteTransfer->/** @scrutinizer ignore-call */ 
43
                            setPayment($paymentTransfer);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
        }
44
45
        return $quoteTransfer;
1 ignored issue
show
Bug Best Practice introduced by
The expression return $quoteTransfer returns the type Spryker\Shared\Kernel\Transfer\AbstractTransfer which is incompatible with the documented return type Generated\Shared\Transfer\QuoteTransfer.
Loading history...
46
    }
47
48
    /**
49
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
50
     *
51
     * @return array
52
     */
53
    public function getOptions(AbstractTransfer $quoteTransfer)
54
    {
55
        if ($quoteTransfer->getHeidelpayPayment()) {
0 ignored issues
show
Bug introduced by
The method getHeidelpayPayment() does not exist on Spryker\Shared\Kernel\Transfer\AbstractTransfer. ( Ignorable by Annotation )

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

55
        if ($quoteTransfer->/** @scrutinizer ignore-call */ getHeidelpayPayment()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
56
            $legalText = $quoteTransfer->getHeidelpayPayment()->getLegalText();
57
        }
58
59
        return [
60
            EasyCreditSubForm::VARS_KEY_LEGAL_TEXT => $legalText ?? '',
61
            EasyCreditSubForm::VARS_KEY_LOGO_URL => $this->heidelPayConfig->getEasyCreditLogoUrl(),
62
            EasyCreditSubForm::VARS_KEY_INFO_LINK => $this->heidelPayConfig->getEasyCreditInfoLink(),
63
        ];
64
    }
65
}
66