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

AbstractAuthorizationContainer   A

Complexity

Total Complexity 30

Size/Duplication

Total Lines 362
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 30
lcom 0
cbo 1
dl 0
loc 362
rs 10
c 0
b 0
f 0

30 Methods

Rating   Name   Duplication   Size   Complexity  
A getBusinessrelation() 0 4 1
A setBusinessrelation() 0 4 1
A setAid() 0 4 1
A getAid() 0 4 1
A setAmount() 0 4 1
A getAmount() 0 4 1
A setClearingType() 0 4 1
A getClearingType() 0 4 1
A setCurrency() 0 4 1
A getCurrency() 0 4 1
A setNarrativeText() 0 4 1
A getNarrativeText() 0 4 1
A setParam() 0 4 1
A getParam() 0 4 1
A setReference() 0 4 1
A getReference() 0 4 1
A setPersonalData() 0 4 1
A getPersonalData() 0 4 1
A setShippingData() 0 4 1
A getShippingData() 0 4 1
A setPaymentMethod() 0 4 1
A getPaymentMethod() 0 4 1
A set3dsecure() 0 4 1
A get3dsecure() 0 4 1
A setInvoicing() 0 4 1
A getInvoicing() 0 4 1
A getOnlinebanktransfertype() 0 4 1
A setOnlinebanktransfertype() 0 4 1
A getClearingsubtype() 0 4 1
A setClearingsubtype() 0 4 1
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 string
106
     */
107
    protected $businessrelation;
108
109
    /**
110
     * @return string|null
111
     */
112
    public function getBusinessrelation(): ?string
113
    {
114
        return $this->businessrelation;
115
    }
116
117
    /**
118
     * @param string $businessrelation
119
     */
120
    public function setBusinessrelation(string $businessrelation): void
121
    {
122
        $this->businessrelation = $businessrelation;
123
    }
124
125
    /**
126
     * @param int $aid
127
     *
128
     * @return void
129
     */
130
    public function setAid($aid)
131
    {
132
        $this->aid = $aid;
133
    }
134
135
    /**
136
     * @return int
137
     */
138
    public function getAid()
139
    {
140
        return $this->aid;
141
    }
142
143
    /**
144
     * @param int $amount
145
     *
146
     * @return void
147
     */
148
    public function setAmount($amount)
149
    {
150
        $this->amount = $amount;
151
    }
152
153
    /**
154
     * @return int
155
     */
156
    public function getAmount()
157
    {
158
        return $this->amount;
159
    }
160
161
    /**
162
     * @param string $clearingType
163
     *
164
     * @return void
165
     */
166
    public function setClearingType($clearingType)
167
    {
168
        $this->clearingtype = $clearingType;
169
    }
170
171
    /**
172
     * @return string
173
     */
174
    public function getClearingType()
175
    {
176
        return $this->clearingtype;
177
    }
178
179
    /**
180
     * @param string $currency
181
     *
182
     * @return void
183
     */
184
    public function setCurrency($currency)
185
    {
186
        $this->currency = $currency;
187
    }
188
189
    /**
190
     * @return string
191
     */
192
    public function getCurrency()
193
    {
194
        return $this->currency;
195
    }
196
197
    /**
198
     * @param string $narrative_text
199
     *
200
     * @return void
201
     */
202
    public function setNarrativeText($narrative_text)
203
    {
204
        $this->narrative_text = $narrative_text;
205
    }
206
207
    /**
208
     * @return string
209
     */
210
    public function getNarrativeText()
211
    {
212
        return $this->narrative_text;
213
    }
214
215
    /**
216
     * @param string $param
217
     *
218
     * @return void
219
     */
220
    public function setParam($param)
221
    {
222
        $this->param = $param;
223
    }
224
225
    /**
226
     * @return string
227
     */
228
    public function getParam()
229
    {
230
        return $this->param;
231
    }
232
233
    /**
234
     * @param string $reference
235
     *
236
     * @return void
237
     */
238
    public function setReference($reference)
239
    {
240
        $this->reference = $reference;
241
    }
242
243
    /**
244
     * @return string
245
     */
246
    public function getReference()
247
    {
248
        return $this->reference;
249
    }
250
251
    /**
252
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer $personalData
253
     *
254
     * @return void
255
     */
256
    public function setPersonalData(PersonalContainer $personalData)
257
    {
258
        $this->personalData = $personalData;
259
    }
260
261
    /**
262
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer
263
     */
264
    public function getPersonalData()
265
    {
266
        return $this->personalData;
267
    }
268
269
    /**
270
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ShippingContainer $delivery
271
     *
272
     * @return void
273
     */
274
    public function setShippingData(ShippingContainer $delivery)
275
    {
276
        $this->shippingData = $delivery;
277
    }
278
279
    /**
280
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ShippingContainer
281
     */
282
    public function getShippingData()
283
    {
284
        return $this->shippingData;
285
    }
286
287
    /**
288
     * @param PaymentMethod\AbstractPaymentMethodContainer $paymentMethod
289
     *
290
     * @return void
291
     */
292
    public function setPaymentMethod(AbstractPaymentMethodContainer $paymentMethod)
293
    {
294
        $this->paymentMethod = $paymentMethod;
295
    }
296
297
    /**
298
     * @return PaymentMethod\AbstractPaymentMethodContainer
299
     */
300
    public function getPaymentMethod()
301
    {
302
        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...
303
    }
304
305
    /**
306
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ThreeDSecureContainer $secure
307
     *
308
     * @return void
309
     */
310
    public function set3dsecure(ThreeDSecureContainer $secure)
311
    {
312
        $this->_3dsecure = $secure;
313
    }
314
315
    /**
316
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ThreeDSecureContainer
317
     */
318
    public function get3dsecure()
319
    {
320
        return $this->_3dsecure;
321
    }
322
323
    /**
324
     * @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Invoicing\TransactionContainer $invoicing
325
     *
326
     * @return void
327
     */
328
    public function setInvoicing(TransactionContainer $invoicing)
329
    {
330
        $this->invoicing = $invoicing;
331
    }
332
333
    /**
334
     * @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Invoicing\TransactionContainer
335
     */
336
    public function getInvoicing()
337
    {
338
        return $this->invoicing;
339
    }
340
341
    /**
342
     * @return string
343
     */
344
    public function getOnlinebanktransfertype()
345
    {
346
        return $this->onlinebanktransfertype;
347
    }
348
349
    /**
350
     * @param string $onlinebanktransfertype
351
     *
352
     * @return void
353
     */
354
    public function setOnlinebanktransfertype($onlinebanktransfertype)
355
    {
356
        $this->onlinebanktransfertype = $onlinebanktransfertype;
357
    }
358
359
    /**
360
     * @return string
361
     */
362
    public function getClearingsubtype(): string
363
    {
364
        return $this->clearingsubtype;
365
    }
366
367
    /**
368
     * @param string $clearingsubtype
369
     *
370
     * @return void
371
     */
372
    public function setClearingsubtype(string $clearingsubtype): void
373
    {
374
        $this->clearingsubtype = $clearingsubtype;
375
    }
376
}
377