Completed
Push — master ( 56a686...736967 )
by Oleksandr
15s queued 11s
created

mapEntityToHeidelpayDirectDebitRegistrationTransfer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 18
rs 9.9
cc 1
nc 1
nop 2
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\Zed\Heidelpay\Persistence\Propel\Mapper;
9
10
use Generated\Shared\Transfer\HeidelpayDirectDebitAccountTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...ectDebitAccountTransfer 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\HeidelpayDirectDebitRegistrationTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...bitRegistrationTransfer 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\HeidelpayNotificationCollectionTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...ationCollectionTransfer 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 Generated\Shared\Transfer\HeidelpayNotificationTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...payNotificationTransfer 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...
14
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...
15
use Generated\Shared\Transfer\HeidelpayTransactionLogTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...yTransactionLogTransfer 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...
16
use 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...
17
use Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayDirectDebitRegistration;
1 ignored issue
show
Bug introduced by
The type Orm\Zed\Heidelpay\Persis...DirectDebitRegistration 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...
18
use Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayNotification;
1 ignored issue
show
Bug introduced by
The type Orm\Zed\Heidelpay\Persis...ntHeidelpayNotification 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...
19
use Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayTransactionLog;
1 ignored issue
show
Bug introduced by
The type Orm\Zed\Heidelpay\Persis...HeidelpayTransactionLog 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...
20
use Propel\Runtime\Collection\ObjectCollection;
21
22
class HeidelpayPersistenceMapper
23
{
24
    /**
25
     * @param \Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpay $paymentHeidelpayEntity
26
     * @param \Generated\Shared\Transfer\HeidelpayPaymentTransfer $heidelpayPaymentTransfer
27
     *
28
     * @return \Generated\Shared\Transfer\HeidelpayPaymentTransfer
29
     */
30
    public function mapEntityToHeidelpayPaymentTransfer(
31
        SpyPaymentHeidelpay $paymentHeidelpayEntity,
32
        HeidelpayPaymentTransfer $heidelpayPaymentTransfer
33
    ): HeidelpayPaymentTransfer {
34
        $heidelpayPaymentTransfer->fromArray(
35
            $paymentHeidelpayEntity->toArray(),
36
            true
37
        );
38
39
        return $heidelpayPaymentTransfer;
40
    }
41
42
    /**
43
     * @param \Propel\Runtime\Collection\ObjectCollection|\Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayNotification[] $paymentHeidelpayNotificationEntities
44
     * @param \Generated\Shared\Transfer\HeidelpayNotificationCollectionTransfer $heidelpayNotificationCollection
45
     *
46
     * @return \Generated\Shared\Transfer\HeidelpayNotificationCollectionTransfer
47
     */
48
    public function mapNotificationEntitiesToHeidelpayNotificationCollection(
49
        ObjectCollection $paymentHeidelpayNotificationEntities,
50
        HeidelpayNotificationCollectionTransfer $heidelpayNotificationCollection
51
    ): HeidelpayNotificationCollectionTransfer {
52
        foreach ($paymentHeidelpayNotificationEntities as $paymentHeidelpayNotificationEntity) {
53
            $heidelpayNotificationTransfer = $this->mapEntityToHeidelpayNotificationTransfer(
54
                $paymentHeidelpayNotificationEntity,
55
                new HeidelpayNotificationTransfer()
56
            );
57
            $heidelpayNotificationCollection->addNotification($heidelpayNotificationTransfer);
58
        }
59
60
        return $heidelpayNotificationCollection;
61
    }
62
63
    /**
64
     * @param \Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayNotification $paymentHeidelpayNotificationEntity
65
     * @param \Generated\Shared\Transfer\HeidelpayNotificationTransfer $heidelpayNotificationTransfer
66
     *
67
     * @return \Generated\Shared\Transfer\HeidelpayNotificationTransfer
68
     */
69
    public function mapEntityToHeidelpayNotificationTransfer(
70
        SpyPaymentHeidelpayNotification $paymentHeidelpayNotificationEntity,
71
        HeidelpayNotificationTransfer $heidelpayNotificationTransfer
72
    ): HeidelpayNotificationTransfer {
73
        $heidelpayNotificationTransfer->fromArray(
74
            $paymentHeidelpayNotificationEntity->toArray(),
75
            true
76
        );
77
78
        return $heidelpayNotificationTransfer;
79
    }
80
81
    /**
82
     * @param \Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayDirectDebitRegistration $paymentHeidelpayDirectDebitRegistrationEntity
83
     * @param \Generated\Shared\Transfer\HeidelpayDirectDebitRegistrationTransfer $directDebitRegistrationTransfer
84
     *
85
     * @return \Generated\Shared\Transfer\HeidelpayDirectDebitRegistrationTransfer
86
     */
87
    public function mapEntityToHeidelpayDirectDebitRegistrationTransfer(
88
        SpyPaymentHeidelpayDirectDebitRegistration $paymentHeidelpayDirectDebitRegistrationEntity,
89
        HeidelpayDirectDebitRegistrationTransfer $directDebitRegistrationTransfer
90
    ): HeidelpayDirectDebitRegistrationTransfer {
91
        $directDebitRegistrationTransfer
92
            ->setIdDirectDebitRegistration($paymentHeidelpayDirectDebitRegistrationEntity->getIdDirectDebitRegistration())
93
            ->setIdCustomerAddress($paymentHeidelpayDirectDebitRegistrationEntity->getFkCustomerAddress())
94
            ->setRegistrationUniqueId($paymentHeidelpayDirectDebitRegistrationEntity->getRegistrationUniqueId())
95
            ->setTransactionId($paymentHeidelpayDirectDebitRegistrationEntity->getTransactionId())
96
            ->setAccountInfo(
97
                (new HeidelpayDirectDebitAccountTransfer())
98
                    ->fromArray(
99
                        $paymentHeidelpayDirectDebitRegistrationEntity->toArray(),
100
                        true
101
                    )
102
            );
103
104
        return $directDebitRegistrationTransfer;
105
    }
106
107
    /**
108
     * @param \Orm\Zed\Heidelpay\Persistence\SpyPaymentHeidelpayTransactionLog $paymentHeidelpayTransactionLogEntity
109
     * @param \Generated\Shared\Transfer\HeidelpayTransactionLogTransfer $heidelpayTransactionLogTransfer
110
     *
111
     * @return \Generated\Shared\Transfer\HeidelpayTransactionLogTransfer
112
     */
113
    public function mapEntityToHeidelpayTransactionLogTransfer(
114
        SpyPaymentHeidelpayTransactionLog $paymentHeidelpayTransactionLogEntity,
115
        HeidelpayTransactionLogTransfer $heidelpayTransactionLogTransfer
116
    ): HeidelpayTransactionLogTransfer {
117
        $heidelpayTransactionLogTransfer->fromArray(
118
            $paymentHeidelpayTransactionLogEntity->toArray(),
119
            true
120
        )->setIdSalesOrder($paymentHeidelpayTransactionLogEntity->getFkSalesOrder());
121
122
        return $heidelpayTransactionLogTransfer;
123
    }
124
}
125