1 | <?php |
||
16 | abstract class AbstractRequest implements RequestInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var AbstractMerchant |
||
20 | */ |
||
21 | public $merchant; |
||
22 | |||
23 | /** |
||
24 | * @var string The type of request. For example: |
||
25 | * - `purchase` |
||
26 | * - `completePurchase` |
||
27 | */ |
||
28 | public $type; |
||
29 | |||
30 | /** |
||
31 | * @var array the data that will be sent to the payment system. |
||
32 | * Might be additionally processed by the implementation of [[AbstractRequest]] class. |
||
33 | */ |
||
34 | public $data = []; |
||
35 | |||
36 | /** |
||
37 | * The instance of payment processing library. |
||
38 | * @return \Omnipay\Common\Message\AbstractRequest|\Payum\Core\Model\Payment |
||
39 | */ |
||
40 | abstract public function getWorker(); |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function getCurrency() |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | public function getAmount() |
||
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | public function getFee() |
||
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getCommissionFee() |
||
73 | |||
74 | /** |
||
75 | * @return string |
||
76 | */ |
||
77 | public function getTotalFee() |
||
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getSum() |
||
89 | |||
90 | /** |
||
91 | * @return AbstractResponse |
||
92 | */ |
||
93 | public function send() |
||
97 | |||
98 | /** |
||
99 | * Concrete requests can build type in other way. |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | 1 | public function getType() |
|
107 | |||
108 | /** |
||
109 | * @return array |
||
110 | */ |
||
111 | public function getData() |
||
112 | { |
||
113 | return $this->data; |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Use worker's method when possible. |
||
118 | * |
||
119 | * @param $name |
||
120 | * @param $args |
||
121 | * @return mixed|null |
||
122 | */ |
||
123 | public function __call($name, $args) |
||
131 | } |
||
132 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.