Code Duplication    Length = 10-10 lines in 8 locations

src/onepay/PaymentGateway.php 3 locations

@@ 181-190 (lines=10) @@
178
    /**
179
     * @inheritdoc
180
     */
181
    public function verifiedRequest(VerifiedRequestEvent $event)
182
    {
183
        if ($event->command === self::VRC_PURCHASE_SUCCESS_INTERNATIONAL) {
184
            $this->trigger(self::EVENT_VERIFIED_REQUEST_PURCHASE_INTERNATIONAL_SUCCESS, $event);
185
        } elseif ($event->command === self::VRC_IPN_INTERNATIONAL) {
186
            $this->trigger(self::EVENT_VERIFIED_REQUEST_IPN_INTERNATIONAL, $event);
187
        }
188
189
        parent::verifiedRequest($event);
190
    }
191
192
    /**
193
     * @inheritdoc
@@ 153-162 (lines=10) @@
150
    /**
151
     * @inheritdoc
152
     */
153
    public function beforeRequest(RequestEvent $event)
154
    {
155
        if ($event->command === self::RC_PURCHASE_INTERNATIONAL) {
156
            $this->trigger(self::EVENT_BEFORE_PURCHASE_INTERNATIONAL, $event);
157
        } elseif ($event->command === self::RC_QUERY_DR_INTERNATIONAL) {
158
            $this->trigger(self::EVENT_BEFORE_QUERY_DR_INTERNATIONAL, $event);
159
        }
160
161
        parent::beforeRequest($event);
162
    }
163
164
    /**
165
     * @inheritdoc
@@ 167-176 (lines=10) @@
164
    /**
165
     * @inheritdoc
166
     */
167
    public function afterRequest(RequestEvent $event)
168
    {
169
        if ($event->command === self::RC_PURCHASE_INTERNATIONAL) {
170
            $this->trigger(self::EVENT_AFTER_PURCHASE_INTERNATIONAL, $event);
171
        } elseif ($event->command === self::RC_QUERY_DR_INTERNATIONAL) {
172
            $this->trigger(self::EVENT_AFTER_QUERY_DR_INTERNATIONAL, $event);
173
        }
174
175
        parent::afterRequest($event);
176
    }
177
178
    /**
179
     * @inheritdoc

src/baokim/PaymentGateway.php 2 locations

@@ 253-262 (lines=10) @@
250
    /**
251
     * @inheritdoc
252
     */
253
    public function beforeRequest(RequestEvent $event)
254
    {
255
        if ($event->command === self::RC_PURCHASE_PRO) {
256
            $this->trigger(self::EVENT_BEFORE_PURCHASE_PRO, $event);
257
        } elseif ($event->command === self::RC_GET_MERCHANT_DATA) {
258
            $this->trigger(self::EVENT_BEFORE_GET_MERCHANT_DATA, $event);
259
        }
260
261
        parent::beforeRequest($event);
262
    }
263
264
    /**
265
     * @inheritdoc
@@ 267-276 (lines=10) @@
264
    /**
265
     * @inheritdoc
266
     */
267
    public function afterRequest(RequestEvent $event)
268
    {
269
        if ($event->command === self::RC_PURCHASE_PRO) {
270
            $this->trigger(self::EVENT_AFTER_PURCHASE_PRO, $event);
271
        } elseif ($event->command === self::RC_GET_MERCHANT_DATA) {
272
            $this->trigger(self::EVENT_AFTER_GET_MERCHANT_DATA, $event);
273
        }
274
275
        parent::afterRequest($event);
276
    }
277
278
    /**
279
     * @inheritdoc

src/BasePaymentGateway.php 3 locations

@@ 184-193 (lines=10) @@
181
    /**
182
     * @inheritdoc
183
     */
184
    public function beforeRequest(RequestEvent $event)
185
    {
186
        if ($event->command === self::RC_PURCHASE) {
187
            $this->trigger(self::EVENT_BEFORE_PURCHASE, $event);
188
        } elseif ($event->command === self::RC_QUERY_DR) {
189
            $this->trigger(self::EVENT_BEFORE_QUERY_DR, $event);
190
        }
191
192
        parent::beforeRequest($event);
193
    }
194
195
    /**
196
     * @inheritdoc
@@ 198-207 (lines=10) @@
195
    /**
196
     * @inheritdoc
197
     */
198
    public function afterRequest(RequestEvent $event)
199
    {
200
        if ($event->command === self::RC_PURCHASE) {
201
            $this->trigger(self::EVENT_AFTER_PURCHASE, $event);
202
        } elseif ($event->command === self::RC_QUERY_DR) {
203
            $this->trigger(self::EVENT_AFTER_QUERY_DR, $event);
204
        }
205
206
        parent::afterRequest($event);
207
    }
208
209
    /**
210
     * Phương thức này là phương thức ánh xạ của [[verifyRequest()]] nó sẽ tạo lệnh [[VRC_PURCHASE_SUCCESS]]
@@ 289-298 (lines=10) @@
286
     *
287
     * @param VerifiedRequestEvent $event
288
     */
289
    public function verifiedRequest(VerifiedRequestEvent $event)
290
    {
291
        if ($event->command === self::VRC_IPN) {
292
            $this->trigger(self::EVENT_VERIFIED_REQUEST_IPN, $event);
293
        } elseif ($event->command === self::VRC_PURCHASE_SUCCESS) {
294
            $this->trigger(self::EVENT_VERIFIED_REQUEST_PURCHASE_SUCCESS, $event);
295
        }
296
297
        $this->trigger(self::EVENT_VERIFIED_REQUEST, $event);
298
    }
299
300
301
}