Code Duplication    Length = 20-21 lines in 2 locations

core/db_classes/EE_Registration.class.php 2 locations

@@ 182-202 (lines=21) @@
179
        // these reg statuses should not be considered in any calculations involving monies owing
180
        $closed_reg_statuses = EEM_Registration::closed_reg_statuses();
181
        // true if registration has been cancelled or declined
182
        if (
183
            in_array($new_STS_ID, $closed_reg_statuses, true)
184
            && ! in_array($old_STS_ID, $closed_reg_statuses, true)
185
        ) {
186
            /** @type EE_Registration_Processor $registration_processor */
187
            $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
188
            /** @type EE_Transaction_Processor $transaction_processor */
189
            $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
190
            // cancelled or declined registration
191
            $registration_processor->update_registration_after_being_canceled_or_declined(
192
                $this,
193
                $closed_reg_statuses
194
            );
195
            $transaction_processor->update_transaction_after_canceled_or_declined_registration(
196
                $this,
197
                $closed_reg_statuses,
198
                false
199
            );
200
            do_action('AHEE__EE_Registration__set_status__canceled_or_declined', $this, $old_STS_ID, $new_STS_ID);
201
            return;
202
        }
203
        // true if reinstating cancelled or declined registration
204
        if (
205
            in_array($old_STS_ID, $closed_reg_statuses, true)
@@ 204-223 (lines=20) @@
201
            return;
202
        }
203
        // true if reinstating cancelled or declined registration
204
        if (
205
            in_array($old_STS_ID, $closed_reg_statuses, true)
206
            && ! in_array($new_STS_ID, $closed_reg_statuses, true)
207
        ) {
208
            /** @type EE_Registration_Processor $registration_processor */
209
            $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
210
            /** @type EE_Transaction_Processor $transaction_processor */
211
            $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
212
            // reinstating cancelled or declined registration
213
            $registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
214
                $this,
215
                $closed_reg_statuses
216
            );
217
            $transaction_processor->update_transaction_after_reinstating_canceled_registration(
218
                $this,
219
                $closed_reg_statuses,
220
                false
221
            );
222
            do_action('AHEE__EE_Registration__set_status__after_reinstated', $this, $old_STS_ID, $new_STS_ID);
223
        }
224
	}
225
226