Passed
Pull Request — master (#23)
by Volodymyr
07:31
created

AbstractAuthorizationContainer::getEmail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\Payone\Business\Api\Request\Container\Authorization;
9
10
use SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer;
11
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\AbstractPaymentMethodContainer;
12
use SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainerInterface;
13
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Invoicing\TransactionContainer;
14
15
abstract class AbstractAuthorizationContainer extends AbstractRequestContainer implements AuthorizationContainerInterface
16
{
17
    /**
18
     * Sub account ID
19
     *
20
     * @var int
21
     */
22
    protected $aid;
23
24
    /**
25
     * @var string
26
     */
27
    protected $clearingtype;
28
29
    /**
30
     * @var string
31
     */
32
    protected $clearingsubtype;
33
34
    /**
35
     * Merchant reference number for the payment process. (Permitted symbols: 0-9, a-z, A-Z, .,-,_,/)
36
     *
37
     * @var string
38
     */
39
    protected $reference;
40
41
    /**
42
     * Total amount (in smallest currency unit! e.g. cent)
43
     *
44
     * @var int
45
     */
46
    protected $amount;
47
48
    /**
49
     * Currency (ISO-4217)
50
     *
51
     * @var string
52
     */
53
    protected $currency;
54
55
    /**
56
     * Individual parameter
57
     *
58
     * @var string
59
     */
60
    protected $param;
61
62
    /**
63
     * dynamic text for debit and creditcard payments
64
     *
65
     * @var string
66
     */
67
    protected $narrative_text;
68
69
    /**
70
     * @var \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer
71
     */
72
    protected $personalData;
73
74
    /**
75
     * @var \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ShippingContainer
76
     */
77
    protected $shippingData;
78
79
    /**
80
     * @var \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\AbstractPaymentMethodContainer
81
     */
82
    protected $paymentMethod;
83
84
    /**
85
     * @var \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ThreeDSecureContainer
86
     */
87
    protected $_3dsecure;
88
89
    /**
90
     * @var \SprykerEco\Zed\Payone\Business\Api\Request\Container\Invoicing\TransactionContainer
91
     */
92
    protected $invoicing;
93
94
    /**
95
     * @var string
96
     */
97
    protected $onlinebanktransfertype;
98
99
    /**
100
     * @var string
101
     */
102
    protected $bankcountry;
103
104
    /**
105
     * @var array
106
     */
107
    protected $it;
108
109
    /**
110
     * @var array
111
     */
112
    protected $id;
113
114
    /**
115
     * @var array
116
     */
117
    protected $pr;
118
119
    /**
120
     * @var array
121
     */
122
    protected $no;
123
124
    /**
125
     * @var array
126
     */
127
    protected $de;
128
129
    /**
130
     * @var array
131
     */
132
    protected $va;
133
134
    /**
135
     * @var string
136
     */
137
    protected $email;
138
139
    /**
140
     * @param int $aid
141
     *
142
     * @return void
143
     */
144
    public function setAid($aid)
145
    {
146
        $this->aid = $aid;
147
    }
148
149
    /**
150
     * @return int
151
     */
152
    public function getAid()
153
    {
154
        return $this->aid;
155
    }
156
157
    /**
158
     * @param int $amount
159
     *
160
     * @return void
161
     */
162
    public function setAmount($amount)
163
    {
164
        $this->amount = $amount;
165
    }
166
167
    /**
168
     * @return int
169
     */
170
    public function getAmount()
171
    {
172
        return $this->amount;
173
    }
174
175
    /**
176
     * @param string $clearingType
177
     *
178
     * @return void
179
     */
180
    public function setClearingType($clearingType)
181
    {
182
        $this->clearingtype = $clearingType;
183
    }
184
185
    /**
186
     * @return string
187
     */
188
    public function getClearingType()
189
    {
190
        return $this->clearingtype;
191
    }
192
193
    /**
194
     * @param string $currency
195
     *
196
     * @return void
197
     */
198
    public function setCurrency($currency)
199
    {
200
        $this->currency = $currency;
201
    }
202
203
    /**
204
     * @return string
205
     */
206
    public function getCurrency()
207
    {
208
        return $this->currency;
209
    }
210
211
    /**
212
     * @param string $narrative_text
213
     *
214
     * @return void
215
     */
216
    public function setNarrativeText($narrative_text)
217
    {
218
        $this->narrative_text = $narrative_text;
219
    }
220
221
    /**
222
     * @return string
223
     */
224
    public function getNarrativeText()
225
    {
226
        return $this->narrative_text;
227
    }
228
229
    /**
230
     * @param string $param
231
     *
232
     * @return void
233
     */
234
    public function setParam($param)
235
    {
236
        $this->param = $param;
237
    }
238
239
    /**
240
     * @return string
241
     */
242
    public function getParam()
243
    {
244
        return $this->param;
245
    }
246
247
    /**
248
     * @param string $reference
249
     *
250
     * @return void
251
     */
252
    public function setReference($reference)
253
    {
254
        $this->reference = $reference;
255
    }
256
257
    /**
258
     * @return string
259
     */
260
    public function getReference()
261
    {
262
        return $this->reference;
263
    }
264
265
    /**
266
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer $personalData
267
     *
268
     * @return void
269
     */
270
    public function setPersonalData(PersonalContainer $personalData)
271
    {
272
        $this->personalData = $personalData;
273
    }
274
275
    /**
276
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer
277
     */
278
    public function getPersonalData()
279
    {
280
        return $this->personalData;
281
    }
282
283
    /**
284
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ShippingContainer $delivery
285
     *
286
     * @return void
287
     */
288
    public function setShippingData(ShippingContainer $delivery)
289
    {
290
        $this->shippingData = $delivery;
291
    }
292
293
    /**
294
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ShippingContainer
295
     */
296
    public function getShippingData()
297
    {
298
        return $this->shippingData;
299
    }
300
301
    /**
302
     * @param PaymentMethod\AbstractPaymentMethodContainer $paymentMethod
303
     *
304
     * @return void
305
     */
306
    public function setPaymentMethod(AbstractPaymentMethodContainer $paymentMethod)
307
    {
308
        $this->paymentMethod = $paymentMethod;
309
    }
310
311
    /**
312
     * @return PaymentMethod\AbstractPaymentMethodContainer
313
     */
314
    public function getPaymentMethod()
315
    {
316
        return $this->paymentMethod;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->paymentMethod; (SprykerEco\Zed\Payone\Bu...tPaymentMethodContainer) is incompatible with the return type declared by the interface SprykerEco\Zed\Payone\Bu...rface::getPaymentMethod of type SprykerEco\Zed\Payone\Bu...tPaymentMethodContainer.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
317
    }
318
319
    /**
320
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ThreeDSecureContainer $secure
321
     *
322
     * @return void
323
     */
324
    public function set3dsecure(ThreeDSecureContainer $secure)
325
    {
326
        $this->_3dsecure = $secure;
327
    }
328
329
    /**
330
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ThreeDSecureContainer
331
     */
332
    public function get3dsecure()
333
    {
334
        return $this->_3dsecure;
335
    }
336
337
    /**
338
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Invoicing\TransactionContainer $invoicing
339
     *
340
     * @return void
341
     */
342
    public function setInvoicing(TransactionContainer $invoicing)
343
    {
344
        $this->invoicing = $invoicing;
345
    }
346
347
    /**
348
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Invoicing\TransactionContainer
349
     */
350
    public function getInvoicing()
351
    {
352
        return $this->invoicing;
353
    }
354
355
    /**
356
     * @return string
357
     */
358
    public function getOnlinebanktransfertype()
359
    {
360
        return $this->onlinebanktransfertype;
361
    }
362
363
    /**
364
     * @param string $onlinebanktransfertype
365
     *
366
     * @return void
367
     */
368
    public function setOnlinebanktransfertype($onlinebanktransfertype)
369
    {
370
        $this->onlinebanktransfertype = $onlinebanktransfertype;
371
    }
372
373
    /**
374
     * @return string
375
     */
376
    public function getClearingsubtype(): string
377
    {
378
        return $this->clearingsubtype;
379
    }
380
381
    /**
382
     * @param string $clearingsubtype
383
     *
384
     * @return void
385
     */
386
    public function setClearingsubtype(string $clearingsubtype): void
387
    {
388
        $this->clearingsubtype = $clearingsubtype;
389
    }
390
391
    /**
392
     * @return array
393
     */
394
    public function getIt(): array
395
    {
396
        return $this->it;
397
    }
398
399
    /**
400
     * @param array $it
401
     */
402
    public function setIt(array $it): void
403
    {
404
        $this->it = $it;
405
    }
406
407
    /**
408
     * @return array
409
     */
410
    public function getId(): array
411
    {
412
        return $this->id;
413
    }
414
415
    /**
416
     * @param array $id
417
     */
418
    public function setId(array $id): void
419
    {
420
        $this->id = $id;
421
    }
422
423
    /**
424
     * @return array
425
     */
426
    public function getPr(): array
427
    {
428
        return $this->pr;
429
    }
430
431
    /**
432
     * @param array $pr
433
     */
434
    public function setPr(array $pr): void
435
    {
436
        $this->pr = $pr;
437
    }
438
439
    /**
440
     * @return array
441
     */
442
    public function getNo(): array
443
    {
444
        return $this->no;
445
    }
446
447
    /**
448
     * @param array $no
449
     */
450
    public function setNo(array $no): void
451
    {
452
        $this->no = $no;
453
    }
454
455
    /**
456
     * @return array
457
     */
458
    public function getDe(): array
459
    {
460
        return $this->de;
461
    }
462
463
    /**
464
     * @param array $de
465
     */
466
    public function setDe(array $de): void
467
    {
468
        $this->de = $de;
469
    }
470
471
    /**
472
     * @return array
473
     */
474
    public function getVa(): array
475
    {
476
        return $this->va;
477
    }
478
479
    /**
480
     * @param array $va
481
     */
482
    public function setVa(array $va): void
483
    {
484
        $this->va = $va;
485
    }
486
487
    /**
488
     * @return string
489
     */
490
    public function getEmail(): string
491
    {
492
        return $this->email;
493
    }
494
495
    /**
496
     * @param string $email
497
     */
498
    public function setEmail(string $email): void
499
    {
500
        $this->email = $email;
501
    }
502
}
503