Code Duplication    Length = 29-30 lines in 2 locations

core/db_classes/EE_Registration.class.php 2 locations

@@ 242-271 (lines=30) @@
239
     * @throws InvalidInterfaceException
240
     * @throws ReflectionException
241
     */
242
    private function updateIfCanceled(array $closed_reg_statuses, $new_STS_ID, $old_STS_ID, Context $context = null)
243
    {
244
        // true if registration has been cancelled or declined
245
        if (in_array($new_STS_ID, $closed_reg_statuses, true)
246
            && ! in_array($old_STS_ID, $closed_reg_statuses, true)
247
        ) {
248
            /** @type EE_Registration_Processor $registration_processor */
249
            $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
250
            /** @type EE_Transaction_Processor $transaction_processor */
251
            $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
252
            // cancelled or declined registration
253
            $registration_processor->update_registration_after_being_canceled_or_declined(
254
                $this,
255
                $closed_reg_statuses
256
            );
257
            $transaction_processor->update_transaction_after_canceled_or_declined_registration(
258
                $this,
259
                $closed_reg_statuses,
260
                false
261
            );
262
            do_action(
263
                'AHEE__EE_Registration__set_status__canceled_or_declined',
264
                $this,
265
                $old_STS_ID,
266
                $new_STS_ID,
267
                $context
268
            );
269
            return;
270
        }
271
    }
272
273
274
    /**
@@ 287-315 (lines=29) @@
284
     * @throws InvalidInterfaceException
285
     * @throws ReflectionException
286
     */
287
    private function updateIfDeclined(array $closed_reg_statuses, $new_STS_ID, $old_STS_ID, Context $context = null)
288
    {
289
        // true if reinstating cancelled or declined registration
290
        if (in_array($old_STS_ID, $closed_reg_statuses, true)
291
            && ! in_array($new_STS_ID, $closed_reg_statuses, true)
292
        ) {
293
            /** @type EE_Registration_Processor $registration_processor */
294
            $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
295
            /** @type EE_Transaction_Processor $transaction_processor */
296
            $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
297
            // reinstating cancelled or declined registration
298
            $registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
299
                $this,
300
                $closed_reg_statuses
301
            );
302
            $transaction_processor->update_transaction_after_reinstating_canceled_registration(
303
                $this,
304
                $closed_reg_statuses,
305
                false
306
            );
307
            do_action(
308
                'AHEE__EE_Registration__set_status__after_reinstated',
309
                $this,
310
                $old_STS_ID,
311
                $new_STS_ID,
312
                $context
313
            );
314
        }
315
    }
316
317
318
    /**