Code Duplication    Length = 10-15 lines in 8 locations

caffeinated/admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 1 location

@@ 1020-1031 (lines=12) @@
1017
                    $errors++;
1018
                }
1019
            }
1020
        } else {
1021
            EE_Error::add_error(
1022
                esc_html__(
1023
                    'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!',
1024
                    'event_espresso'
1025
                ),
1026
                __FILE__,
1027
                __FUNCTION__,
1028
                __LINE__
1029
            );
1030
            $this->_redirect_after_action(false, '', '', $query_args, true);
1031
        }
1032
        if ($errors > 0) {
1033
            EE_Error::add_error(
1034
                sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),

core/db_classes/EE_Base_Class.class.php 1 location

@@ 1210-1224 (lines=15) @@
1207
    public function get_DateTime_object($field_name)
1208
    {
1209
        $field_settings = $this->get_model()->field_settings_for($field_name);
1210
        if (! $field_settings instanceof EE_Datetime_Field) {
1211
            EE_Error::add_error(
1212
                sprintf(
1213
                    esc_html__(
1214
                        'The field %s is not an EE_Datetime_Field field.  There is no DateTime object stored on this field type.',
1215
                        'event_espresso'
1216
                    ),
1217
                    $field_name
1218
                ),
1219
                __FILE__,
1220
                __FUNCTION__,
1221
                __LINE__
1222
            );
1223
            return false;
1224
        }
1225
        return isset($this->_fields[ $field_name ]) && $this->_fields[ $field_name ] instanceof DateTime
1226
            ? clone $this->_fields[ $field_name ]
1227
            : null;

modules/single_page_checkout/reg_steps/attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 1 location

@@ 978-989 (lines=12) @@
975
        // grab the saved registrations from the transaction
976
        foreach ($registrations as $registration) {
977
            // verify EE_Registration object
978
            if (! $registration instanceof EE_Registration) {
979
                EE_Error::add_error(
980
                    esc_html__(
981
                        'An invalid Registration object was discovered when attempting to process your registration information.',
982
                        'event_espresso'
983
                    ),
984
                    __FILE__,
985
                    __FUNCTION__,
986
                    __LINE__
987
                );
988
                return false;
989
            }
990
            /** @var string $reg_url_link */
991
            $reg_url_link = $registration->reg_url_link();
992
            // reg_url_link exists ?

admin_pages/messages/Messages_Admin_Page.core.php 2 locations

@@ 4107-4116 (lines=10) @@
4104
        EE_Message_Type $message_type = null
4105
    ) {
4106
        // if $messenger isn't a valid messenger object then get out.
4107
        if (! $messenger instanceof EE_Messenger) {
4108
            EE_Error::add_error(
4109
                esc_html__('The messenger being activated is not a valid messenger', 'event_espresso'),
4110
                __FILE__,
4111
                __FUNCTION__,
4112
                __LINE__
4113
            );
4114
4115
            return false;
4116
        }
4117
        // activated
4118
        if ($this->_template_args['data']['active_mts']) {
4119
            EE_Error::overwrite_success();
@@ 4218-4227 (lines=10) @@
4215
        EE_Error::overwrite_success();
4216
4217
        // if $messenger isn't a valid messenger object then get out.
4218
        if (! $messenger instanceof EE_Messenger) {
4219
            EE_Error::add_error(
4220
                esc_html__('The messenger being deactivated is not a valid messenger', 'event_espresso'),
4221
                __FILE__,
4222
                __FUNCTION__,
4223
                __LINE__
4224
            );
4225
4226
            return false;
4227
        }
4228
4229
        if ($message_type instanceof EE_message_type) {
4230
            $message_type_name = $message_type->name;

core/business/EE_Registration_Processor.class.php 1 location

@@ 708-719 (lines=12) @@
705
        );
706
        // grab the related ticket object for this line_item
707
        $ticket = $line_item->ticket();
708
        if (! $ticket instanceof EE_Ticket) {
709
            EE_Error::add_error(
710
                sprintf(
711
                    esc_html__('Line item %s did not contain a valid ticket', 'event_espresso'),
712
                    $line_item->ID()
713
                ),
714
                __FILE__,
715
                __FUNCTION__,
716
                __LINE__
717
            );
718
            return null;
719
        }
720
        $registration_service = new CreateRegistrationService();
721
        // then generate a new registration from that
722
        return $registration_service->create(

admin_pages/transactions/Transactions_Admin_Page.core.php 1 location

@@ 502-511 (lines=10) @@
499
            $this->_transaction->verify_abandoned_transaction_status();
500
        }
501
502
        if (! $this->_transaction instanceof EE_Transaction) {
503
            $error_msg = sprintf(
504
                esc_html__(
505
                    'An error occurred and the details for the transaction with the ID # %d could not be retrieved.',
506
                    'event_espresso'
507
                ),
508
                $TXN_ID
509
            );
510
            EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
511
        }
512
    }
513
514

core/EE_Session.core.php 1 location

@@ 588-602 (lines=15) @@
585
            return false;
586
        }
587
        foreach ($data as $key => $value) {
588
            if (isset($this->_default_session_vars[ $key ])) {
589
                EE_Error::add_error(
590
                    sprintf(
591
                        esc_html__(
592
                            'Sorry! %s is a default session datum and can not be reset.',
593
                            'event_espresso'
594
                        ),
595
                        $key
596
                    ),
597
                    __FILE__,
598
                    __FUNCTION__,
599
                    __LINE__
600
                );
601
                return false;
602
            }
603
            $this->_session_data[ $key ] = $value;
604
            $this->setSaveState();
605
        }