Issues (359)

DataProvider/CashOnDeliveryFormDataProvider.php (8 issues)

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\CrefoPay\Form\DataProvider;
9
10
use Generated\Shared\Transfer\CrefoPayPaymentTransfer;
0 ignored issues
show
The type Generated\Shared\Transfer\CrefoPayPaymentTransfer 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;
0 ignored issues
show
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 Generated\Shared\Transfer\QuoteTransfer;
0 ignored issues
show
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...
13
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
14
use Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface;
15
use SprykerEco\Yves\CrefoPay\CrefoPayConfig;
16
use SprykerEco\Yves\CrefoPay\Form\CashOnDeliverySubForm;
17
18
class CashOnDeliveryFormDataProvider implements StepEngineFormDataProviderInterface
19
{
20
    /**
21
     * @var \SprykerEco\Yves\CrefoPay\CrefoPayConfig
22
     */
23
    protected $config;
24
25
    /**
26
     * @param \SprykerEco\Yves\CrefoPay\CrefoPayConfig $config
27
     */
28
    public function __construct(CrefoPayConfig $config)
29
    {
30
        $this->config = $config;
31
    }
32
33
    /**
34
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
35
     *
36
     * @return \Generated\Shared\Transfer\QuoteTransfer
37
     */
38
    public function getData(AbstractTransfer $quoteTransfer): QuoteTransfer
39
    {
40
        if ($quoteTransfer->getPayment() === null) {
0 ignored issues
show
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

40
        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...
41
            $quoteTransfer->setPayment(new PaymentTransfer());
0 ignored issues
show
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

41
            $quoteTransfer->/** @scrutinizer ignore-call */ 
42
                            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...
42
        }
43
44
        if ($quoteTransfer->getPayment()->getCrefoPayCashOnDelivery() !== null) {
45
            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...
46
        }
47
48
        $quoteTransfer->getPayment()->setCrefoPayCashOnDelivery(new CrefoPayPaymentTransfer());
49
50
        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...
51
    }
52
53
    /**
54
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
55
     *
56
     * @return array
57
     */
58
    public function getOptions(AbstractTransfer $quoteTransfer): array
59
    {
60
        return [
61
            CashOnDeliverySubForm::CREFO_PAY_SHOP_PUBLIC_KEY => $this->config->getPublicKey(),
62
            CashOnDeliverySubForm::CREFO_PAY_ORDER_ID => $quoteTransfer->getCrefoPayTransaction()->getCrefoPayOrderId(),
0 ignored issues
show
The method getCrefoPayTransaction() 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

62
            CashOnDeliverySubForm::CREFO_PAY_ORDER_ID => $quoteTransfer->/** @scrutinizer ignore-call */ getCrefoPayTransaction()->getCrefoPayOrderId(),

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...
63
            CashOnDeliverySubForm::CREFO_PAY_SECURE_FIELDS_API_ENDPOINT => $this->config->getSecureFieldsApiEndpoint(),
64
            CashOnDeliverySubForm::CREFO_PAY_SECURE_FIELDS_PLACEHOLDERS => $this->config->getSecureFieldsPlaceholders(),
65
        ];
66
    }
67
}
68