Completed
Push — master ( b2ba42...b33960 )
by Joachim
26:09
created

Payment::setPaymentGatewayCurrencyCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace Loevgaard\DandomainAltapayBundle\Entity;
3
4
use Doctrine\Common\Collections\ArrayCollection;
5
use Doctrine\ORM\Mapping AS ORM;
6
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
7
use Loevgaard\DandomainFoundationBundle\Model\OrderInterface;
8
9
/**
10
 * @ORM\MappedSuperclass
11
 */
12
abstract class Payment implements PaymentInterface
13
{
14
    use ORMBehaviors\Timestampable\Timestampable;
15
16
    /**
17
     * @var mixed
18
     */
19
    protected $id;
20
21
    /**
22
     * @var string
23
     *
24
     * @ORM\Column(type="string")
25
     */
26
    protected $apiKey;
27
28
    /**
29
     * @var string
30
     *
31
     * @ORM\Column(type="string")
32
     */
33
    protected $merchant;
34
35
    /**
36
     * @var OrderInterface
37
     *
38
     * @todo can we make the orm definition?
39
     */
40
    protected $order;
41
42
    /**
43
     * @var string
44
     *
45
     * @ORM\Column(type="string")
46
     */
47
    protected $sessionId;
48
49
    /**
50
     * @var string
51
     *
52
     * @ORM\Column(type="string")
53
     */
54
    protected $currencySymbol;
55
56
    /**
57
     * @var float
58
     *
59
     * @ORM\Column(type="decimal", scale=2, precision=10)
60
     */
61
    protected $totalAmount;
62
63
    /**
64
     * @var string
65
     *
66
     * @ORM\Column(type="string")
67
     */
68
    protected $callBackUrl;
69
70
    /**
71
     * @var string
72
     *
73
     * @ORM\Column(type="string")
74
     */
75
    protected $fullCallBackOkUrl;
76
77
    /**
78
     * @var string
79
     *
80
     * @ORM\Column(type="string")
81
     */
82
    protected $callBackOkUrl;
83
84
    /**
85
     * @var string
86
     *
87
     * @ORM\Column(type="string")
88
     */
89
    protected $callBackServerUrl;
90
91
    /**
92
     * @var boolean
93
     *
94
     * @ORM\Column(type="boolean")
95
     */
96
    protected $testMode;
97
98
    /**
99
     * @var int
100
     *
101
     * @ORM\Column(type="integer")
102
     */
103
    protected $paymentGatewayCurrencyCode;
104
105
    /**
106
     * @var int
107
     *
108
     * @ORM\Column(type="integer")
109
     */
110
    protected $cardTypeId;
111
112
    /**
113
     * @var Callback[]
114
     */
115
    protected $callbacks;
116
117
    public function __construct()
118
    {
119
        $this->callbacks = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,callable> of property $callbacks.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
120
    }
121
122
    /**
123
     * @inheritdoc
124
     */
125
    public function getId()
126
    {
127
        return $this->id;
128
    }
129
130
    /**
131
     * @inheritdoc
132
     */
133
    public function getApiKey() : string
134
    {
135
        return $this->apiKey;
136
    }
137
138
    /**
139
     * @inheritdoc
140
     */
141
    public function setApiKey(string $apiKey) : PaymentInterface
142
    {
143
        $this->apiKey = $apiKey;
144
        return $this;
145
    }
146
147
    /**
148
     * @inheritdoc
149
     */
150
    public function getMerchant() : string
151
    {
152
        return $this->merchant;
153
    }
154
155
    /**
156
     * @inheritdoc
157
     */
158
    public function setMerchant(string $merchant) : PaymentInterface
159
    {
160
        $this->merchant = $merchant;
161
        return $this;
162
    }
163
164
    /**
165
     * @inheritdoc
166
     */
167
    public function getOrder() : OrderInterface
168
    {
169
        return $this->order;
170
    }
171
172
    /**
173
     * @inheritdoc
174
     */
175
    public function setOrderId(OrderInterface $order) : PaymentInterface
176
    {
177
        $this->order = $order;
178
        return $this;
179
    }
180
181
    /**
182
     * @inheritdoc
183
     */
184
    public function getSessionId() : string
185
    {
186
        return $this->sessionId;
187
    }
188
189
    /**
190
     * @inheritdoc
191
     */
192
    public function setSessionId(string $sessionId) : PaymentInterface
193
    {
194
        $this->sessionId = $sessionId;
195
        return $this;
196
    }
197
198
    /**
199
     * @inheritdoc
200
     */
201
    public function getCurrencySymbol() : string
202
    {
203
        return $this->currencySymbol;
204
    }
205
206
    /**
207
     * @inheritdoc
208
     */
209
    public function setCurrencySymbol(string $currencySymbol) : PaymentInterface
210
    {
211
        $this->currencySymbol = $currencySymbol;
212
        return $this;
213
    }
214
215
    /**
216
     * @inheritdoc
217
     */
218
    public function getTotalAmount() : float
219
    {
220
        return $this->totalAmount;
221
    }
222
223
    /**
224
     * @inheritdoc
225
     */
226
    public function setTotalAmount(float $totalAmount) : PaymentInterface
227
    {
228
        $this->totalAmount = $totalAmount;
229
        return $this;
230
    }
231
232
    /**
233
     * @inheritdoc
234
     */
235
    public function getCallBackUrl() : string
236
    {
237
        return $this->callBackUrl;
238
    }
239
240
    /**
241
     * @inheritdoc
242
     */
243
    public function setCallBackUrl(string $callBackUrl) : PaymentInterface
244
    {
245
        $this->callBackUrl = $callBackUrl;
246
        return $this;
247
    }
248
249
    /**
250
     * @inheritdoc
251
     */
252
    public function getFullCallBackOkUrl() : string
253
    {
254
        return $this->fullCallBackOkUrl;
255
    }
256
257
    /**
258
     * @inheritdoc
259
     */
260
    public function setFullCallBackOkUrl(string $fullCallBackOkUrl) : PaymentInterface
261
    {
262
        $this->fullCallBackOkUrl = $fullCallBackOkUrl;
263
        return $this;
264
    }
265
266
    /**
267
     * @inheritdoc
268
     */
269
    public function getCallBackOkUrl() : string
270
    {
271
        return $this->callBackOkUrl;
272
    }
273
274
    /**
275
     * @inheritdoc
276
     */
277
    public function setCallBackOkUrl(string $callBackOkUrl) : PaymentInterface
278
    {
279
        $this->callBackOkUrl = $callBackOkUrl;
280
        return $this;
281
    }
282
283
    /**
284
     * @inheritdoc
285
     */
286
    public function getCallBackServerUrl() : string
287
    {
288
        return $this->callBackServerUrl;
289
    }
290
291
    /**
292
     * @inheritdoc
293
     */
294
    public function setCallBackServerUrl(string $callBackServerUrl) : PaymentInterface
295
    {
296
        $this->callBackServerUrl = $callBackServerUrl;
297
        return $this;
298
    }
299
300
    /**
301
     * @inheritdoc
302
     */
303
    public function setLanguageId(int $languageId) : PaymentInterface
304
    {
305
        $this->languageId = $languageId;
0 ignored issues
show
Bug introduced by
The property languageId does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
306
        return $this;
307
    }
308
309
    /**
310
     * @inheritdoc
311
     */
312
    public function isTestMode(): bool
313
    {
314
        return $this->testMode;
315
    }
316
317
    /**
318
     * @inheritdoc
319
     */
320
    public function setTestMode(bool $testMode) : PaymentInterface
321
    {
322
        $this->testMode = $testMode;
323
        return $this;
324
    }
325
326
    /**
327
     * @inheritdoc
328
     */
329
    public function getPaymentGatewayCurrencyCode()
330
    {
331
        return $this->paymentGatewayCurrencyCode;
332
    }
333
334
    /**
335
     * @inheritdoc
336
     */
337
    public function setPaymentGatewayCurrencyCode(int $paymentGatewayCurrencyCode) : PaymentInterface
338
    {
339
        $this->paymentGatewayCurrencyCode = $paymentGatewayCurrencyCode;
340
        return $this;
341
    }
342
343
    /**
344
     * @inheritdoc
345
     */
346
    public function getCardTypeId()
347
    {
348
        return $this->cardTypeId;
349
    }
350
351
    /**
352
     * @inheritdoc
353
     */
354
    public function setCardTypeId(int $cardTypeId) : PaymentInterface
355
    {
356
        $this->cardTypeId = $cardTypeId;
357
        return $this;
358
    }
359
360
    /**
361
     * @inheritdoc
362
     */
363
    public function getCallbacks() : ArrayCollection
364
    {
365
        return $this->callbacks;
366
    }
367
368
    /**
369
     * @inheritdoc
370
     */
371
    public function setCallbacks(ArrayCollection $callbacks) : PaymentInterface
372
    {
373
        $this->callbacks = $callbacks;
0 ignored issues
show
Documentation Bug introduced by
It seems like $callbacks of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,callable> of property $callbacks.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
374
        return $this;
375
    }
376
377
    /**
378
     * @inheritdoc
379
     */
380
    public function addCallback(CallbackInterface $callback) : PaymentInterface
381
    {
382
        $this->callbacks[] = $callback;
383
        $callback->setPayment($this);
384
        return $this;
385
    }
386
}