ComputopPaymentReader::getPaymentTransfer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
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\Zed\Computop\Business\Payment\Reader;
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 SprykerEco\Zed\Computop\Persistence\ComputopQueryContainerInterface;
12
13
class ComputopPaymentReader implements ComputopPaymentReaderInterface
14
{
15
    /**
16
     * @var \SprykerEco\Zed\Computop\Persistence\ComputopQueryContainerInterface
17
     */
18
    protected $queryContainer;
19
20
    /**
21
     * @param \SprykerEco\Zed\Computop\Persistence\ComputopQueryContainerInterface $queryContainer
22
     */
23
    public function __construct(ComputopQueryContainerInterface $queryContainer)
24
    {
25
        $this->queryContainer = $queryContainer;
26
    }
27
28
    /**
29
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
30
     *
31
     * @return \Generated\Shared\Transfer\QuoteTransfer
32
     */
33
    public function isComputopPaymentExist(QuoteTransfer $quoteTransfer)
34
    {
35
        $paymentTransfer = $this->getPaymentTransfer($quoteTransfer);
36
        $paymentEntity = $this->queryContainer->queryPaymentByTransactionId($paymentTransfer->getTransId())->findOne();
0 ignored issues
show
Bug introduced by
The method getTransId() 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

36
        $paymentEntity = $this->queryContainer->queryPaymentByTransactionId($paymentTransfer->/** @scrutinizer ignore-call */ getTransId())->findOne();

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...
37
        if (isset($paymentEntity)) {
38
            $quoteTransfer->getPayment()->setIsComputopPaymentExist(true);
39
        }
40
41
        return $quoteTransfer;
42
    }
43
44
    /**
45
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
46
     *
47
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
48
     */
49
    protected function getPaymentTransfer(QuoteTransfer $quoteTransfer)
50
    {
51
        $paymentSelection = $quoteTransfer->getPayment()->getPaymentSelection();
52
        $method = 'get' . ucfirst($paymentSelection);
53
54
        return $quoteTransfer->getPayment()->$method();
55
    }
56
}
57