InvoiceSecuredB2cDataProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 8
c 0
b 0
f 0
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 13 3
A getOptions() 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\Heidelpay\Form\DataProvider;
9
10
use Generated\Shared\Transfer\HeidelpayPaymentTransfer;
11
use Generated\Shared\Transfer\PaymentTransfer;
12
use Generated\Shared\Transfer\QuoteTransfer;
13
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
14
use Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface;
15
16
class InvoiceSecuredB2cDataProvider implements StepEngineFormDataProviderInterface
17
{
18
    /**
19
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
20
     *
21
     * @return \Generated\Shared\Transfer\QuoteTransfer
22
     */
23
    public function getData(AbstractTransfer $quoteTransfer): QuoteTransfer
24
    {
25
        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

25
        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...
26
            $quoteTransfer->setPayment(new 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

26
            $quoteTransfer->/** @scrutinizer ignore-call */ 
27
                            setPayment(new 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...
27
        }
28
29
        if ($quoteTransfer->getPayment()->getHeidelpayInvoiceSecuredB2c() !== null) {
30
            return $quoteTransfer;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $quoteTransfer returns the type Spryker\Shared\Kernel\Transfer\AbstractTransfer which is incompatible with the type-hinted return Generated\Shared\Transfer\QuoteTransfer.
Loading history...
31
        }
32
33
        $quoteTransfer->getPayment()->setHeidelpayInvoiceSecuredB2c(new HeidelpayPaymentTransfer());
34
35
        return $quoteTransfer;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $quoteTransfer returns the type Spryker\Shared\Kernel\Transfer\AbstractTransfer which is incompatible with the type-hinted return Generated\Shared\Transfer\QuoteTransfer.
Loading history...
36
    }
37
38
    /**
39
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
40
     *
41
     * @return array
42
     */
43
    public function getOptions(AbstractTransfer $quoteTransfer): array
44
    {
45
        return [];
46
    }
47
}
48