This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Payment247\SDK\Notifications; |
||
4 | |||
5 | use Payment247\SDK\Exceptions\FieldNotFoundException; |
||
6 | |||
7 | /** |
||
8 | * Class Notification. |
||
9 | */ |
||
10 | abstract class Notification |
||
11 | { |
||
12 | const SUBTYPE_CONVERSION = 'conversion'; |
||
13 | const SUBTYPE_FAIL = 'fail'; |
||
14 | |||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $raw; |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $fields = []; |
||
24 | |||
25 | /** |
||
26 | * Notification constructor. |
||
27 | * |
||
28 | * @param array $rawNotification |
||
29 | */ |
||
30 | 28 | public function __construct(array $rawNotification) |
|
31 | { |
||
32 | 28 | $this->raw = $rawNotification; |
|
33 | 28 | } |
|
34 | |||
35 | /** |
||
36 | * @return array |
||
37 | */ |
||
38 | 1 | public function toArray() |
|
39 | { |
||
40 | 1 | return $this->raw; |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return string |
||
45 | */ |
||
46 | 1 | public function getType() |
|
47 | { |
||
48 | 1 | return $this->raw['type']; |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return string |
||
53 | */ |
||
54 | 1 | public function getTxnId() |
|
55 | { |
||
56 | 1 | return $this->raw['txn_id']; |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * @return float |
||
61 | */ |
||
62 | 1 | public function getAmount() |
|
63 | { |
||
64 | 1 | return $this->raw['amount']; |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * @return string |
||
69 | */ |
||
70 | 1 | public function getCurrency() |
|
71 | { |
||
72 | 1 | return $this->raw['currency']; |
|
73 | } |
||
74 | |||
75 | /** |
||
76 | * @return float |
||
77 | */ |
||
78 | 1 | public function getExpectedAmountPaid() |
|
79 | { |
||
80 | 1 | return $this->raw['expected_amount_paid']; |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * @return string |
||
85 | */ |
||
86 | 1 | public function getExpectedAmountPaidCurrency() |
|
87 | { |
||
88 | 1 | return $this->raw['expected_amount_paid_currency']; |
|
89 | } |
||
90 | |||
91 | /** |
||
92 | * @return float |
||
93 | */ |
||
94 | 1 | public function getConfirmedAmount() |
|
95 | { |
||
96 | 1 | return $this->raw['confirmed_amount']; |
|
97 | } |
||
98 | |||
99 | /** |
||
100 | * @return string |
||
101 | */ |
||
102 | 1 | public function getConfirmedCurrency() |
|
103 | { |
||
104 | 1 | return $this->raw['confirmed_currency']; |
|
105 | } |
||
106 | |||
107 | /** |
||
108 | * @return string |
||
109 | */ |
||
110 | 1 | public function getUser() |
|
111 | { |
||
112 | 1 | return $this->raw['user']; |
|
113 | } |
||
114 | |||
115 | /** |
||
116 | * @return string |
||
117 | */ |
||
118 | 1 | public function getOrderId() |
|
119 | { |
||
120 | 1 | return $this->raw['order_id']; |
|
121 | } |
||
122 | |||
123 | /** |
||
124 | * @return string |
||
125 | */ |
||
126 | 1 | public function getPs() |
|
127 | { |
||
128 | 1 | return $this->raw['ps']; |
|
129 | } |
||
130 | |||
131 | /** |
||
132 | * @return string |
||
133 | */ |
||
134 | 1 | public function getEmail() |
|
135 | { |
||
136 | 1 | return $this->raw['email']; |
|
137 | } |
||
138 | |||
139 | /** |
||
140 | * @return array |
||
141 | */ |
||
142 | 1 | public function getCustom() |
|
143 | { |
||
144 | 1 | return $this->raw['custom']; |
|
145 | } |
||
146 | |||
147 | /** |
||
148 | * @return bool |
||
149 | */ |
||
150 | 1 | public function isConversion() |
|
151 | { |
||
152 | 1 | return $this->getSubType() === self::SUBTYPE_CONVERSION; |
|
153 | } |
||
154 | |||
155 | /** |
||
156 | * @return string |
||
157 | */ |
||
158 | 8 | public function getSubType() |
|
159 | { |
||
160 | 8 | return $this->raw['subtype']; |
|
161 | } |
||
162 | |||
163 | /** |
||
164 | * @return bool |
||
165 | */ |
||
166 | 1 | public function isFail() |
|
167 | { |
||
168 | 1 | return $this->getSubType() === self::SUBTYPE_FAIL; |
|
169 | } |
||
170 | |||
171 | /** |
||
172 | * @param string $name |
||
173 | * |
||
174 | * @throws \Payment247\SDK\Exceptions\FieldNotFoundException |
||
175 | * |
||
176 | * @return mixed |
||
177 | */ |
||
178 | 2 | View Code Duplication | public function getAttribute($name) |
0 ignored issues
–
show
|
|||
179 | { |
||
180 | 2 | if (!isset($this->raw[$name])) { |
|
181 | 1 | throw new FieldNotFoundException($name); |
|
182 | } |
||
183 | |||
184 | 1 | return $this->raw[$name]; |
|
185 | } |
||
186 | } |
||
187 |
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.