Passed
Push — feature/ECO-442-functional-tes... ( 383be3...37c2cc )
by Mykyta
07:05
created

PaymentReader   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 47
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getPaymentByIdSalesOrder() 0 13 2
A getPaymentEntityByIdSalesOrder() 0 7 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\Heidelpay\Business\Payment;
9
10
use Generated\Shared\Transfer\HeidelpayPaymentTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfer\HeidelpayPaymentTransfer 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\Heidelpay\Persistence\HeidelpayQueryContainerInterface;
12
13
class PaymentReader implements PaymentReaderInterface
14
{
15
    /**
16
     * @var \SprykerEco\Zed\Heidelpay\Persistence\HeidelpayQueryContainerInterface
17
     */
18
    protected $heidelpayQueryContainer;
19
20
    /**
21
     * @param \SprykerEco\Zed\Heidelpay\Persistence\HeidelpayQueryContainerInterface $heidelpayQueryContainer
22
     */
23
    public function __construct(HeidelpayQueryContainerInterface $heidelpayQueryContainer)
24
    {
25
        $this->heidelpayQueryContainer = $heidelpayQueryContainer;
26
    }
27
28
    /**
29
     * @param int $idSalesOrder
30
     *
31
     * @return \Generated\Shared\Transfer\HeidelpayPaymentTransfer
32
     */
33
    public function getPaymentByIdSalesOrder($idSalesOrder)
34
    {
35
        $heidelpayPaymentEntity = $this->getPaymentEntityByIdSalesOrder($idSalesOrder);
36
37
        $paymentTransfer = new HeidelpayPaymentTransfer();
38
39
        if ($heidelpayPaymentEntity === null) {
40
            return $paymentTransfer;
41
        }
42
43
        $paymentTransfer->fromArray($heidelpayPaymentEntity->toArray(), true);
44
45
        return $paymentTransfer;
46
    }
47
48
    /**
49
     * @param int $idSalesOrder
50
     *
51
     * @return \Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpay
1 ignored issue
show
Bug introduced by
The type Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpay 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...
52
     */
53
    protected function getPaymentEntityByIdSalesOrder($idSalesOrder)
54
    {
55
        $heidelpayPaymentEntity = $this->heidelpayQueryContainer
56
            ->queryPaymentByIdSalesOrder($idSalesOrder)
57
            ->findOne();
58
59
        return $heidelpayPaymentEntity;
60
    }
61
}
62