AbstractFormDataProvider::getOptions()   A
last analyzed

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
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Yves\Computop\Form\DataProvider;
9
10
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...
11
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
12
use Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface;
13
use SprykerEco\Yves\Computop\Dependency\Client\ComputopToQuoteClientInterface;
14
use SprykerEco\Yves\Computop\Mapper\Init\MapperInterface;
15
16
abstract class AbstractFormDataProvider implements StepEngineFormDataProviderInterface
17
{
18
    /**
19
     * @var \SprykerEco\Yves\Computop\Dependency\Client\ComputopToQuoteClientInterface
20
     */
21
    protected $quoteClient;
22
23
    /**
24
     * @var \SprykerEco\Yves\Computop\Mapper\Init\MapperInterface
25
     */
26
    protected $mapper;
27
28
    /**
29
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
30
     *
31
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
32
     */
33
    abstract protected function getComputopPayment(QuoteTransfer $quoteTransfer);
34
35
    /**
36
     * @param \SprykerEco\Yves\Computop\Dependency\Client\ComputopToQuoteClientInterface $quoteClient
37
     * @param \SprykerEco\Yves\Computop\Mapper\Init\MapperInterface $mapper
38
     */
39
    public function __construct(ComputopToQuoteClientInterface $quoteClient, MapperInterface $mapper)
40
    {
41
        $this->quoteClient = $quoteClient;
42
        $this->mapper = $mapper;
43
    }
44
45
    /**
46
     * @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
47
     *
48
     * @return array
49
     */
50
    public function getOptions(AbstractTransfer $quoteTransfer)
51
    {
52
        return [];
53
    }
54
55
    /**
56
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
57
     *
58
     * @return bool
59
     */
60
    protected function isValidPayment(QuoteTransfer $quoteTransfer)
61
    {
62
        if ($this->getComputopPayment($quoteTransfer) === null) {
63
            return false;
64
        }
65
66
        return $this->getComputopPayment($quoteTransfer)->getAmount() === $quoteTransfer->getTotals()->getGrandTotal();
0 ignored issues
show
Bug introduced by
The method getAmount() does not exist on Spryker\Shared\Kernel\Transfer\TransferInterface. ( Ignorable by Annotation )

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

66
        return $this->getComputopPayment($quoteTransfer)->/** @scrutinizer ignore-call */ getAmount() === $quoteTransfer->getTotals()->getGrandTotal();

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...
67
    }
68
}
69