Passed
Push — feature/eco-3623-payone-pay-u-... ( 0a3f73...4fb100 )
by Roman
03:15
created

mapPaymentComputopOrderItemEntityCollectionToComputopPaymentComputopOrderItemTransferCollection()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 14
rs 10
cc 2
nc 2
nop 2
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\Persistence\Propel\Mapper;
9
10
use Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...tComputopDetailTransfer 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\ComputopPaymentComputopOrderItemCollectionTransfer;
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...
12
use Generated\Shared\Transfer\ComputopPaymentComputopOrderItemTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...mputopOrderItemTransfer 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\ComputopPaymentComputopTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...PaymentComputopTransfer 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\ComputopSalesOrderItemCollectionTransfer;
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...
15
use Generated\Shared\Transfer\ComputopSalesOrderItemTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...pSalesOrderItemTransfer 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\Computop\Persistence\SpyPaymentComputop;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Computop\Persistence\SpyPaymentComputop 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\Computop\Persistence\SpyPaymentComputopDetail;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Computop\Persist...pyPaymentComputopDetail 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\Computop\Persistence\SpyPaymentComputopOrderItem;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Computop\Persist...aymentComputopOrderItem 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\Sales\Persistence\SpySalesOrderItem;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Sales\Persistence\SpySalesOrderItem 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\Collection;
21
22
class ComputopMapper
23
{
24
    /**
25
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputop $computopPaymentEntity
26
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopTransfer $computopPaymentTransfer
27
     *
28
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopTransfer
29
     */
30
    public function mapComputopPaymentEntityToComputopPaymentTransfer(
31
        SpyPaymentComputop $computopPaymentEntity,
32
        ComputopPaymentComputopTransfer $computopPaymentTransfer
33
    ): ComputopPaymentComputopTransfer {
34
        return $computopPaymentTransfer
35
            ->fromArray($computopPaymentEntity->toArray(), true)
36
            ->setFKSalesOrder($computopPaymentEntity->getFkSalesOrder());
37
    }
38
39
    /**
40
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopTransfer $computopPaymentTransfer
41
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputop $computopPaymentEntity
42
     *
43
     * @return \Orm\Zed\Computop\Persistence\SpyPaymentComputop
44
     */
45
    public function mapComputopPaymentTransferToComputopPaymentEntity(
46
        ComputopPaymentComputopTransfer $computopPaymentTransfer,
47
        SpyPaymentComputop $computopPaymentEntity
48
    ): SpyPaymentComputop {
49
        return $computopPaymentEntity->fromArray($computopPaymentTransfer->modifiedToArray());
50
    }
51
52
    /**
53
     * @param \Propel\Runtime\Collection\Collection $salesOrderItemsCollection
54
     * @param \Generated\Shared\Transfer\ComputopSalesOrderItemCollectionTransfer $computopSalesOrderItemCollectionTransfer
55
     *
56
     * @return \Generated\Shared\Transfer\ComputopSalesOrderItemCollectionTransfer
57
     */
58
    public function mapSalesOrderItemsCollectionToComputopSalesOrderItemCollectionTransfer(
59
        Collection $salesOrderItemsCollection,
60
        ComputopSalesOrderItemCollectionTransfer $computopSalesOrderItemCollectionTransfer
61
    ): ComputopSalesOrderItemCollectionTransfer {
62
        foreach ($salesOrderItemsCollection as $salesOrderItem) {
63
            $computopSalesOrderItemTransfer = $this
64
                ->mapSalesOrderItemToComputopSalesOrderItemTransfer($salesOrderItem, new ComputopSalesOrderItemTransfer());
65
            $computopSalesOrderItemCollectionTransfer->addComputopSalesOrderItem($computopSalesOrderItemTransfer);
66
        }
67
68
        return $computopSalesOrderItemCollectionTransfer;
69
    }
70
71
    /**
72
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem $salesOrderItem
73
     * @param \Generated\Shared\Transfer\ComputopSalesOrderItemTransfer $computopSalesOrderItemTransfer
74
     *
75
     * @return \Generated\Shared\Transfer\ComputopSalesOrderItemTransfer
76
     */
77
    public function mapSalesOrderItemToComputopSalesOrderItemTransfer(
78
        SpySalesOrderItem $salesOrderItem,
79
        ComputopSalesOrderItemTransfer $computopSalesOrderItemTransfer
80
    ): ComputopSalesOrderItemTransfer {
81
        return $computopSalesOrderItemTransfer->fromArray($salesOrderItem->toArray(), true);
82
    }
83
84
    /**
85
     * @param \Propel\Runtime\Collection\Collection $paymentComputopOrderItemsCollection
86
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemCollectionTransfer $computopPaymentComputopOrderItemCollectionTransfer
87
     *
88
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemCollectionTransfer
89
     */
90
    public function mapPaymentComputopOrderItemEntityCollectionToComputopPaymentComputopOrderItemTransferCollection(
91
        Collection $paymentComputopOrderItemsCollection,
92
        ComputopPaymentComputopOrderItemCollectionTransfer $computopPaymentComputopOrderItemCollectionTransfer
93
    ): ComputopPaymentComputopOrderItemCollectionTransfer {
94
        foreach ($paymentComputopOrderItemsCollection as $paymentComputopOrderItem) {
95
            $computopPaymentOrderItemTransfer = $this
96
                ->mapPaymentComputopOrderItemEntityToComputopPaymentComputopOrderItemTransfer(
97
                    $paymentComputopOrderItem,
98
                    new ComputopPaymentComputopOrderItemTransfer()
99
                );
100
            $computopPaymentComputopOrderItemCollectionTransfer->addComputopPaymentComputopOrderItem($computopPaymentOrderItemTransfer);
101
        }
102
103
        return $computopPaymentComputopOrderItemCollectionTransfer;
104
    }
105
106
    /**
107
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputopOrderItem $spyPaymentComputopOrderItem
108
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer
109
     *
110
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemTransfer
111
     */
112
    public function mapPaymentComputopOrderItemEntityToComputopPaymentComputopOrderItemTransfer(
113
        SpyPaymentComputopOrderItem $spyPaymentComputopOrderItem,
114
        ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer
115
    ): ComputopPaymentComputopOrderItemTransfer {
116
        return $computopPaymentComputopOrderItemTransfer
117
            ->fromArray($spyPaymentComputopOrderItem->toArray(), true)
118
            ->setIsNew($spyPaymentComputopOrderItem->isNew());
119
    }
120
121
    /**
122
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer
123
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputopOrderItem $spyPaymentComputopOrderItem
124
     *
125
     * @return \Orm\Zed\Computop\Persistence\SpyPaymentComputopOrderItem
126
     */
127
    public function mapComputopPaymentComputopOrderItemTransferToPaymentComputopOrderItemEntity(
128
        ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer,
129
        SpyPaymentComputopOrderItem $spyPaymentComputopOrderItem
130
    ): SpyPaymentComputopOrderItem {
131
        $spyPaymentComputopOrderItem->fromArray($computopPaymentComputopOrderItemTransfer->toArray());
132
        $spyPaymentComputopOrderItem->setNew($computopPaymentComputopOrderItemTransfer->getIsNew());
133
134
        return $spyPaymentComputopOrderItem;
135
    }
136
137
    /**
138
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputopDetail $paymentComputopDetailEntity
139
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer $computopPaymentComputopDetailTransfer
140
     *
141
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer
142
     */
143
    public function mapPaymentComputopDetailEntityToComputopPaymentComputopDetailTransfer(
144
        SpyPaymentComputopDetail $paymentComputopDetailEntity,
145
        ComputopPaymentComputopDetailTransfer $computopPaymentComputopDetailTransfer
146
    ): ComputopPaymentComputopDetailTransfer {
147
        return $computopPaymentComputopDetailTransfer->fromArray($paymentComputopDetailEntity->toArray(), true);
148
    }
149
150
    /**
151
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer $computopPaymentComputopTransfer
152
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputopDetail $paymentComputopDetailEntity
153
     *
154
     * @return \Orm\Zed\Computop\Persistence\SpyPaymentComputopDetail
155
     */
156
    public function mapComputopPaymentComputopDetailTransferToPaymentComputopDetailEntity(
157
        ComputopPaymentComputopDetailTransfer $computopPaymentComputopTransfer,
158
        SpyPaymentComputopDetail $paymentComputopDetailEntity
159
    ): SpyPaymentComputopDetail {
160
        return $paymentComputopDetailEntity->fromArray($computopPaymentComputopTransfer->toArray());
161
    }
162
}
163