Passed
Pull Request — feature/eco-3656/dev-paypal-ex... (#40)
by Andrey
10:39 queued 05:25
created

mapSalesOrderItemToComputopSalesOrderItemTransfer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
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
        $computopPaymentTransfer->fromArray($computopPaymentEntity->toArray(), true);
35
36
        return $computopPaymentTransfer;
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
        $computopPaymentEntity->fromArray($computopPaymentTransfer->modifiedToArray());
50
51
        return $computopPaymentEntity;
52
    }
53
54
    /**
55
     * @param \Propel\Runtime\Collection\Collection $salesOrderItemsCollection
56
     * @param \Generated\Shared\Transfer\ComputopSalesOrderItemCollectionTransfer $computopSalesOrderItemCollectionTransfer
57
     *
58
     * @return \Generated\Shared\Transfer\ComputopSalesOrderItemCollectionTransfer
59
     */
60
    public function mapSalesOrderItemsCollectionToComputopSalesOrderItemCollectionTransfer(
61
        Collection $salesOrderItemsCollection,
62
        ComputopSalesOrderItemCollectionTransfer $computopSalesOrderItemCollectionTransfer
63
    ): ComputopSalesOrderItemCollectionTransfer {
64
        foreach ($salesOrderItemsCollection as $salesOrderItem) {
65
            $computopSalesOrderItemTransfer = $this
66
                ->mapSalesOrderItemToComputopSalesOrderItemTransfer($salesOrderItem, new ComputopSalesOrderItemTransfer());
67
            $computopSalesOrderItemCollectionTransfer->addComputopSalesOrderItem($computopSalesOrderItemTransfer);
68
        }
69
70
        return $computopSalesOrderItemCollectionTransfer;
71
    }
72
73
    /**
74
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem $salesOrderItem
75
     * @param \Generated\Shared\Transfer\ComputopSalesOrderItemTransfer $computopSalesOrderItemTransfer
76
     *
77
     * @return \Generated\Shared\Transfer\ComputopSalesOrderItemTransfer
78
     */
79
    public function mapSalesOrderItemToComputopSalesOrderItemTransfer(
80
        SpySalesOrderItem $salesOrderItem,
81
        ComputopSalesOrderItemTransfer $computopSalesOrderItemTransfer
82
    ): ComputopSalesOrderItemTransfer {
83
        $computopSalesOrderItemTransfer->fromArray($salesOrderItem->toArray(), true);
84
85
        return $computopSalesOrderItemTransfer;
86
    }
87
88
    /**
89
     * @param \Propel\Runtime\Collection\Collection $paymentComputopOrderItemsCollection
90
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemCollectionTransfer $computopPaymentComputopOrderItemCollectionTransfer
91
     *
92
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemCollectionTransfer
93
     */
94
    public function mapPaymentComputopOrderItemEntityCollectionToComputopPaymentComputopOrderItemTransferCollection(
95
        Collection $paymentComputopOrderItemsCollection,
96
        ComputopPaymentComputopOrderItemCollectionTransfer $computopPaymentComputopOrderItemCollectionTransfer
97
    ): ComputopPaymentComputopOrderItemCollectionTransfer {
98
        foreach ($paymentComputopOrderItemsCollection as $paymentComputopOrderItem) {
99
            $computopPaymentOrderItemTransfer = $this
100
                ->mapPaymentComputopOrderItemEntityToComputopPaymentComputopOrderItemTransfer(
101
                    $paymentComputopOrderItem,
102
                    new ComputopPaymentComputopOrderItemTransfer()
103
                );
104
            $computopPaymentComputopOrderItemCollectionTransfer->addComputopPaymentComputopOrderItem($computopPaymentOrderItemTransfer);
105
        }
106
107
        return $computopPaymentComputopOrderItemCollectionTransfer;
108
    }
109
110
    /**
111
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputopOrderItem $spyPaymentComputopOrderItem
112
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer
113
     *
114
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemTransfer
115
     */
116
    public function mapPaymentComputopOrderItemEntityToComputopPaymentComputopOrderItemTransfer(
117
        SpyPaymentComputopOrderItem $spyPaymentComputopOrderItem,
118
        ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer
119
    ): ComputopPaymentComputopOrderItemTransfer {
120
        $computopPaymentComputopOrderItemTransfer->fromArray($spyPaymentComputopOrderItem->toArray(), true);
121
122
        return $computopPaymentComputopOrderItemTransfer;
123
    }
124
125
    /**
126
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer
127
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputopOrderItem $spyPaymentComputopOrderItem
128
     *
129
     * @return \Orm\Zed\Computop\Persistence\SpyPaymentComputopOrderItem
130
     */
131
    public function mapComputopPaymentComputopOrderItemTransferToPaymentComputopOrderItemEntity(
132
        ComputopPaymentComputopOrderItemTransfer $computopPaymentComputopOrderItemTransfer,
133
        SpyPaymentComputopOrderItem $spyPaymentComputopOrderItem
134
    ): SpyPaymentComputopOrderItem {
135
        $spyPaymentComputopOrderItem->fromArray($computopPaymentComputopOrderItemTransfer->toArray());
136
137
        return $spyPaymentComputopOrderItem;
138
    }
139
140
    /**
141
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputopDetail $paymentComputopDetailEntity
142
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer $computopPaymentComputopDetailTransfer
143
     *
144
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer
145
     */
146
    public function mapPaymentComputopDetailEntityToComputopPaymentComputopDetailTransfer(
147
        SpyPaymentComputopDetail $paymentComputopDetailEntity,
148
        ComputopPaymentComputopDetailTransfer $computopPaymentComputopDetailTransfer
149
    ): ComputopPaymentComputopDetailTransfer {
150
        $computopPaymentComputopDetailTransfer->fromArray($paymentComputopDetailEntity->toArray(), true);
151
152
        return $computopPaymentComputopDetailTransfer;
153
    }
154
155
    /**
156
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopDetailTransfer $computopPaymentComputopTransfer
157
     * @param \Orm\Zed\Computop\Persistence\SpyPaymentComputopDetail $paymentComputopDetailEntity
158
     *
159
     * @return \Orm\Zed\Computop\Persistence\SpyPaymentComputopDetail
160
     */
161
    public function mapComputopPaymentComputopDetailTransferToPaymentComputopDetailEntity(
162
        ComputopPaymentComputopDetailTransfer $computopPaymentComputopTransfer,
163
        SpyPaymentComputopDetail $paymentComputopDetailEntity
164
    ): SpyPaymentComputopDetail {
165
        $paymentComputopDetailEntity->fromArray($computopPaymentComputopTransfer->toArray());
166
167
        return $paymentComputopDetailEntity;
168
    }
169
}
170