mapOrderItemEntitiesToOrderItemCollection()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
nc 2
nop 2
dl 0
loc 16
rs 10
c 1
b 0
f 0
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\CrefoPay\Persistence\Mapper;
9
10
use ArrayObject;
11
use Generated\Shared\Transfer\PaymentCrefoPayNotificationTransfer;
0 ignored issues
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...
12
use Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...rItemCollectionTransfer 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\PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...oCrefoPayApiLogTransfer 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\PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer;
0 ignored issues
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...
15
use Generated\Shared\Transfer\PaymentCrefoPayOrderItemTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...efoPayOrderItemTransfer 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 Generated\Shared\Transfer\PaymentCrefoPayTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentCrefoPayTransfer 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\CrefoPay\Persistence\SpyPaymentCrefoPay;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\CrefoPay\Persistence\SpyPaymentCrefoPay 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\CrefoPay\Persistence\SpyPaymentCrefoPayNotification;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\CrefoPay\Persist...entCrefoPayNotification 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\CrefoPay\Persistence\SpyPaymentCrefoPayOrderItem;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\CrefoPay\Persist...aymentCrefoPayOrderItem 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 Orm\Zed\CrefoPay\Persistence\SpyPaymentCrefoPayOrderItemToCrefoPayApiLog;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\CrefoPay\Persist...derItemToCrefoPayApiLog 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...
21
use Orm\Zed\CrefoPay\Persistence\SpyPaymentCrefoPayOrderItemToCrefoPayNotification;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\CrefoPay\Persist...mToCrefoPayNotification 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...
22
use Propel\Runtime\Collection\ObjectCollection;
23
24
class CrefoPayPersistenceMapper
25
{
26
    /**
27
     * @param \Propel\Runtime\Collection\ObjectCollection<\Orm\Zed\CrefoPay\Persistence\SpyPaymentCrefoPayOrderItem> $paymentCrefoPayOrderItemEntities
28
     * @param \Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer $crefoPayOrderItemCollectionTransfer
29
     *
30
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemCollectionTransfer
31
     */
32
    public function mapOrderItemEntitiesToOrderItemCollection(
33
        ObjectCollection $paymentCrefoPayOrderItemEntities,
34
        PaymentCrefoPayOrderItemCollectionTransfer $crefoPayOrderItemCollectionTransfer
35
    ): PaymentCrefoPayOrderItemCollectionTransfer {
36
        $result = new ArrayObject();
37
38
        foreach ($paymentCrefoPayOrderItemEntities as $paymentCrefoPayOrderItemEntity) {
39
            $paymentCrefoPayOrderItemTransfer = $this->mapEntityToPaymentCrefoPayOrderItemTransfer(
40
                $paymentCrefoPayOrderItemEntity,
41
                new PaymentCrefoPayOrderItemTransfer(),
42
            );
43
            $result->append($paymentCrefoPayOrderItemTransfer);
44
        }
45
46
        return $crefoPayOrderItemCollectionTransfer
47
            ->setCrefoPayOrderItems($result);
48
    }
49
50
    /**
51
     * @param \Orm\Zed\CrefoPay\Persistence\SpyPaymentCrefoPay $paymentCrefoPayEntity
52
     * @param \Generated\Shared\Transfer\PaymentCrefoPayTransfer $paymentCrefoPayTransfer
53
     *
54
     * @return \Generated\Shared\Transfer\PaymentCrefoPayTransfer
55
     */
56
    public function mapEntityToPaymentCrefoPayTransfer(
57
        SpyPaymentCrefoPay $paymentCrefoPayEntity,
58
        PaymentCrefoPayTransfer $paymentCrefoPayTransfer
59
    ): PaymentCrefoPayTransfer {
60
        $paymentCrefoPayTransfer->fromArray(
61
            $paymentCrefoPayEntity->toArray(),
62
            true,
63
        )->setIdSalesOrder($paymentCrefoPayEntity->getFkSalesOrder());
64
65
        return $paymentCrefoPayTransfer;
66
    }
67
68
    /**
69
     * @param \Orm\Zed\CrefoPay\Persistence\SpyPaymentCrefoPayOrderItem $paymentCrefoPayOrderItemEntity
70
     * @param \Generated\Shared\Transfer\PaymentCrefoPayOrderItemTransfer $paymentCrefoPayOrderItemTransfer
71
     *
72
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemTransfer
73
     */
74
    public function mapEntityToPaymentCrefoPayOrderItemTransfer(
75
        SpyPaymentCrefoPayOrderItem $paymentCrefoPayOrderItemEntity,
76
        PaymentCrefoPayOrderItemTransfer $paymentCrefoPayOrderItemTransfer
77
    ): PaymentCrefoPayOrderItemTransfer {
78
        $paymentCrefoPayOrderItemTransfer
79
            ->fromArray($paymentCrefoPayOrderItemEntity->toArray(), true)
80
            ->setIdPaymentCrefoPay($paymentCrefoPayOrderItemEntity->getFkPaymentCrefoPay())
81
            ->setIdSalesOrderItem($paymentCrefoPayOrderItemEntity->getFkSalesOrderItem());
82
83
        return $paymentCrefoPayOrderItemTransfer;
84
    }
85
86
    /**
87
     * @param \Orm\Zed\CrefoPay\Persistence\SpyPaymentCrefoPayNotification $paymentCrefoPayNotificationEntity
88
     * @param \Generated\Shared\Transfer\PaymentCrefoPayNotificationTransfer $paymentCrefoPayNotificationTransfer
89
     *
90
     * @return \Generated\Shared\Transfer\PaymentCrefoPayNotificationTransfer
91
     */
92
    public function mapEntityToPaymentCrefoPayNotificationTransfer(
93
        SpyPaymentCrefoPayNotification $paymentCrefoPayNotificationEntity,
94
        PaymentCrefoPayNotificationTransfer $paymentCrefoPayNotificationTransfer
95
    ): PaymentCrefoPayNotificationTransfer {
96
        $paymentCrefoPayNotificationTransfer->fromArray(
97
            $paymentCrefoPayNotificationEntity->toArray(),
98
            true,
99
        );
100
101
        return $paymentCrefoPayNotificationTransfer;
102
    }
103
104
    /**
105
     * @param \Orm\Zed\CrefoPay\Persistence\SpyPaymentCrefoPayOrderItemToCrefoPayApiLog $paymentCrefoPayOrderItemToCrefoPayApiLogEntity
106
     * @param \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer $paymentCrefoPayOrderItemToCrefoPayApiLogTransfer
107
     *
108
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer
109
     */
110
    public function mapEntityToPaymentCrefoPayOrderItemToCrefoPayApiLogTransfer(
111
        SpyPaymentCrefoPayOrderItemToCrefoPayApiLog $paymentCrefoPayOrderItemToCrefoPayApiLogEntity,
112
        PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer $paymentCrefoPayOrderItemToCrefoPayApiLogTransfer
113
    ): PaymentCrefoPayOrderItemToCrefoPayApiLogTransfer {
114
        $paymentCrefoPayOrderItemToCrefoPayApiLogTransfer
115
            ->fromArray($paymentCrefoPayOrderItemToCrefoPayApiLogEntity->toArray(), true)
116
            ->setIdPaymentCrefoPayOrderItem($paymentCrefoPayOrderItemToCrefoPayApiLogEntity->getFkPaymentCrefoPayOrderItem())
117
            ->setIdPaymentCrefoPayApiLog($paymentCrefoPayOrderItemToCrefoPayApiLogEntity->getFkPaymentCrefoPayApiLog());
118
119
        return $paymentCrefoPayOrderItemToCrefoPayApiLogTransfer;
120
    }
121
122
    /**
123
     * @param \Orm\Zed\CrefoPay\Persistence\SpyPaymentCrefoPayOrderItemToCrefoPayNotification $paymentCrefoPayOrderItemToCrefoPayNotificationEntity
124
     * @param \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer $paymentCrefoPayOrderItemToCrefoPayNotificationTransfer
125
     *
126
     * @return \Generated\Shared\Transfer\PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer
127
     */
128
    public function mapEntityToPaymentCrefoPayOrderItemToCrefoPayNotificationTransfer(
129
        SpyPaymentCrefoPayOrderItemToCrefoPayNotification $paymentCrefoPayOrderItemToCrefoPayNotificationEntity,
130
        PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer $paymentCrefoPayOrderItemToCrefoPayNotificationTransfer
131
    ): PaymentCrefoPayOrderItemToCrefoPayNotificationTransfer {
132
        $paymentCrefoPayOrderItemToCrefoPayNotificationTransfer
133
            ->fromArray($paymentCrefoPayOrderItemToCrefoPayNotificationEntity->toArray(), true)
134
            ->setIdPaymentCrefoPayOrderItem($paymentCrefoPayOrderItemToCrefoPayNotificationEntity->getFkPaymentCrefoPayOrderItem())
135
            ->setIdPaymentCrefoPayNotification($paymentCrefoPayOrderItemToCrefoPayNotificationEntity->getFkPaymentCrefoPayNotification());
136
137
        return $paymentCrefoPayOrderItemToCrefoPayNotificationTransfer;
138
    }
139
}
140