Code Duplication    Length = 29-30 lines in 2 locations

core/db_classes/EE_Registration.class.php 2 locations

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