Passed
Pull Request — master (#13)
by Volodymyr
04:33
created

mapEntityToPaymentBraintreeOrderItemTransfer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
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\Braintree\Persistence\Mapper;
9
10
use Generated\Shared\Transfer\PaymentBraintreeOrderItemTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...intreeOrderItemTransfer 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\PaymentBraintreeTransactionRequestLogTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ctionRequestLogTransfer 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\PaymentBraintreeTransactionStatusLogTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...actionStatusLogTransfer 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\PaymentBraintreeTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentBraintreeTransfer 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 Orm\Zed\Braintree\Persistence\SpyPaymentBraintree;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Braintree\Persistence\SpyPaymentBraintree 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 Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeOrderItem;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Braintree\Persis...ymentBraintreeOrderItem 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\Braintree\Persistence\SpyPaymentBraintreeTransactionRequestLog;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Braintree\Persis...eeTransactionRequestLog 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\Braintree\Persistence\SpyPaymentBraintreeTransactionStatusLog;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Braintree\Persis...reeTransactionStatusLog 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
19
class BraintreePersistenceMapper implements BraintreePersistenceMapperInterface
20
{
21
    /**
22
     * @param \Generated\Shared\Transfer\PaymentBraintreeTransfer $paymentBraintreeTransfer
23
     * @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintree $paymentBraintreeEntity
24
     *
25
     * @return \Orm\Zed\Braintree\Persistence\SpyPaymentBraintree
26
     */
27
    public function mapPaymentBraintreeTransferToEntity(
28
        PaymentBraintreeTransfer $paymentBraintreeTransfer,
29
        SpyPaymentBraintree $paymentBraintreeEntity
30
    ): SpyPaymentBraintree {
31
        $paymentBraintreeEntity->fromArray($paymentBraintreeTransfer->modifiedToArray());
32
        $paymentBraintreeEntity->setNew($paymentBraintreeTransfer->getIdPaymentBraintree() === null);
33
34
        return $paymentBraintreeEntity;
35
    }
36
37
    /**
38
     * @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintree $paymentBraintreeEntity
39
     * @param \Generated\Shared\Transfer\PaymentBraintreeTransfer $paymentBraintreeTransfer
40
     *
41
     * @return \Generated\Shared\Transfer\PaymentBraintreeTransfer
42
     */
43
    public function mapEntityToPaymentBraintreeTransfer(
44
        SpyPaymentBraintree $paymentBraintreeEntity,
45
        PaymentBraintreeTransfer $paymentBraintreeTransfer
46
    ): PaymentBraintreeTransfer {
47
        return $paymentBraintreeTransfer->fromArray($paymentBraintreeEntity->toArray(), true);
48
    }
49
50
    /**
51
     * @param \Generated\Shared\Transfer\PaymentBraintreeTransactionStatusLogTransfer $paymentBraintreeTransactionStatusLogTransfer
52
     * @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionStatusLog $paymentBraintreeTransactionStatusLogEntity
53
     *
54
     * @return \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionStatusLog
55
     */
56
    public function mapPaymentBraintreeTransactionStatusLogTransferToEntity(
57
        PaymentBraintreeTransactionStatusLogTransfer $paymentBraintreeTransactionStatusLogTransfer,
58
        SpyPaymentBraintreeTransactionStatusLog $paymentBraintreeTransactionStatusLogEntity
59
    ): SpyPaymentBraintreeTransactionStatusLog {
60
        $paymentBraintreeTransactionStatusLogEntity->fromArray($paymentBraintreeTransactionStatusLogTransfer->modifiedToArray());
61
        $paymentBraintreeTransactionStatusLogEntity->setNew($paymentBraintreeTransactionStatusLogTransfer->getIdPaymentBraintreeTransactionStatusLog() === null);
62
63
        return $paymentBraintreeTransactionStatusLogEntity;
64
    }
65
66
    /**
67
     * @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionStatusLog $paymentBraintreeTransactionStatusLogEntity
68
     * @param \Generated\Shared\Transfer\PaymentBraintreeTransactionStatusLogTransfer $paymentBraintreeTransactionStatusLogTransfer
69
     *
70
     * @return \Generated\Shared\Transfer\PaymentBraintreeTransactionStatusLogTransfer
71
     */
72
    public function mapEntityToPaymentBraintreeTransactionStatusLogTransfer(
73
        SpyPaymentBraintreeTransactionStatusLog $paymentBraintreeTransactionStatusLogEntity,
74
        PaymentBraintreeTransactionStatusLogTransfer $paymentBraintreeTransactionStatusLogTransfer
75
    ): PaymentBraintreeTransactionStatusLogTransfer {
76
        return $paymentBraintreeTransactionStatusLogTransfer->fromArray($paymentBraintreeTransactionStatusLogEntity->toArray(), true);
77
    }
78
79
    /**
80
     * @param \Generated\Shared\Transfer\PaymentBraintreeTransactionRequestLogTransfer $paymentBraintreeTransactionRequestLogTransfer
81
     * @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionRequestLog $paymentBraintreeTransactionRequestLogEntity
82
     *
83
     * @return \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionRequestLog
84
     */
85
    public function mapPaymentBraintreeTransactionRequestLogTransferToEntity(
86
        PaymentBraintreeTransactionRequestLogTransfer $paymentBraintreeTransactionRequestLogTransfer,
87
        SpyPaymentBraintreeTransactionRequestLog $paymentBraintreeTransactionRequestLogEntity
88
    ): SpyPaymentBraintreeTransactionRequestLog {
89
        $paymentBraintreeTransactionRequestLogEntity->fromArray($paymentBraintreeTransactionRequestLogTransfer->modifiedToArray());
90
        $paymentBraintreeTransactionRequestLogEntity->setNew($paymentBraintreeTransactionRequestLogTransfer->getIdPaymentBraintreeTransactionRequestLog() === null);
91
92
        return $paymentBraintreeTransactionRequestLogEntity;
93
    }
94
95
    /**
96
     * @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionRequestLog $paymentBraintreeTransactionRequestLogEntity
97
     * @param \Generated\Shared\Transfer\PaymentBraintreeTransactionRequestLogTransfer $paymentBraintreeTransactionRequestLogTransfer
98
     *
99
     * @return \Generated\Shared\Transfer\PaymentBraintreeTransactionRequestLogTransfer
100
     */
101
    public function mapEntityToPaymentBraintreeTransactionRequestLogTransfer(
102
        SpyPaymentBraintreeTransactionRequestLog $paymentBraintreeTransactionRequestLogEntity,
103
        PaymentBraintreeTransactionRequestLogTransfer $paymentBraintreeTransactionRequestLogTransfer
104
    ): PaymentBraintreeTransactionRequestLogTransfer {
105
        return $paymentBraintreeTransactionRequestLogTransfer->fromArray($paymentBraintreeTransactionRequestLogEntity->toArray(), true);
106
    }
107
108
    /**
109
     * @param \Generated\Shared\Transfer\PaymentBraintreeOrderItemTransfer $paymentBraintreeOrderItemTransfer
110
     * @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeOrderItem $paymentBraintreeOrderItemEntity
111
     *
112
     * @return \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeOrderItem
113
     */
114
    public function mapPaymentBraintreeOrderItemTransferToEntity(
115
        PaymentBraintreeOrderItemTransfer $paymentBraintreeOrderItemTransfer,
116
        SpyPaymentBraintreeOrderItem $paymentBraintreeOrderItemEntity
117
    ): SpyPaymentBraintreeOrderItem {
118
        $paymentBraintreeOrderItemEntity->fromArray($paymentBraintreeOrderItemTransfer->modifiedToArray());
119
        $paymentBraintreeOrderItemEntity->setNew($paymentBraintreeOrderItemTransfer->getIdPaymentBraintreeOrderItem() === null);
120
121
        return $paymentBraintreeOrderItemEntity;
122
    }
123
124
    /**
125
     * @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeOrderItem $paymentBraintreeOrderItemEntity
126
     * @param \Generated\Shared\Transfer\PaymentBraintreeOrderItemTransfer $paymentBraintreeOrderItemTransfer
127
     *
128
     * @return \Generated\Shared\Transfer\PaymentBraintreeOrderItemTransfer
129
     */
130
    public function mapEntityToPaymentBraintreeOrderItemTransfer(
131
        SpyPaymentBraintreeOrderItem $paymentBraintreeOrderItemEntity,
132
        PaymentBraintreeOrderItemTransfer $paymentBraintreeOrderItemTransfer
133
    ): PaymentBraintreeOrderItemTransfer {
134
        return $paymentBraintreeOrderItemTransfer->fromArray($paymentBraintreeOrderItemEntity->toArray(), true);
135
    }
136
}
137