1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @link https://github.com/phpviet/omnipay-momo |
4
|
|
|
* @copyright (c) PHP Viet |
5
|
|
|
* @license [MIT](http://www.opensource.org/licenses/MIT) |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Omnipay\MoMo\Concerns; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @author Vuong Minh <[email protected]> |
12
|
|
|
* @since 1.0.0 |
13
|
|
|
*/ |
14
|
|
|
trait Parameters |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* Trả về access key do MoMo cấp. |
18
|
|
|
* |
19
|
|
|
* @return null|string |
20
|
|
|
*/ |
21
|
|
|
public function getAccessKey(): ?string |
22
|
|
|
{ |
23
|
|
|
return $this->getParameter('accessKey'); |
|
|
|
|
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Thiết lập access key do MoMo cấp. |
28
|
|
|
* |
29
|
|
|
* @param null|string $key |
30
|
|
|
* @return $this |
31
|
|
|
*/ |
32
|
|
|
public function setAccessKey(?string $key) |
33
|
|
|
{ |
34
|
|
|
return $this->setParameter('accessKey', $key); |
|
|
|
|
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Trả về secret key do MoMo cấp. |
39
|
|
|
* |
40
|
|
|
* @return null|string |
41
|
|
|
*/ |
42
|
|
|
public function getSecretKey(): ?string |
43
|
|
|
{ |
44
|
|
|
return $this->getParameter('secretKey'); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Thiết lập secret key do MoMo cấp. |
49
|
|
|
* |
50
|
|
|
* @param null|string $key |
51
|
|
|
* @return $this |
52
|
|
|
*/ |
53
|
|
|
public function setSecretKey(?string $key) |
54
|
|
|
{ |
55
|
|
|
return $this->setParameter('secretKey', $key); |
|
|
|
|
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Trả về partner code do MoMo cấp. |
60
|
|
|
* |
61
|
|
|
* @return null|string |
62
|
|
|
*/ |
63
|
|
|
public function getPartnerCode(): ?string |
64
|
|
|
{ |
65
|
|
|
return $this->getParameter('partnerCode'); |
|
|
|
|
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Thiết lập partner code do MoMo cấp. |
70
|
|
|
* |
71
|
|
|
* @param null|string $code |
72
|
|
|
* @return $this |
73
|
|
|
*/ |
74
|
|
|
public function setPartnerCode(?string $code) |
75
|
|
|
{ |
76
|
|
|
return $this->setParameter('partnerCode', $code); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Trả về public key do MoMo cấp. |
81
|
|
|
* |
82
|
|
|
* @return null|string |
83
|
|
|
*/ |
84
|
|
|
public function getPublicKey(): ?string |
85
|
|
|
{ |
86
|
|
|
return $this->getParameter('publicKey'); |
|
|
|
|
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Thiết lập public key do MoMo cấp. |
91
|
|
|
* |
92
|
|
|
* @param null|string $key |
93
|
|
|
* @return $this |
94
|
|
|
*/ |
95
|
|
|
public function setPublicKey(?string $key) |
96
|
|
|
{ |
97
|
|
|
return $this->setParameter('publicKey', $key); |
|
|
|
|
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.