Code Duplication    Length = 10-16 lines in 6 locations

admin_pages/messages/Messages_Admin_Page.core.php 1 location

@@ 1883-1898 (lines=16) @@
1880
        $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID(
1881
            $this->_req_data['message_template_group_id']
1882
        );
1883
        if (! $message_template_group instanceof EE_Message_Template_Group) {
1884
            EE_Error::add_error(
1885
                sprintf(
1886
                    esc_html__(
1887
                        'Unable to change the active state because the given id "%1$d" does not match a valid "%2$s"',
1888
                        'event_espresso'
1889
                    ),
1890
                    $this->_req_data['message_template_group_id'],
1891
                    'EE_Message_Template_Group'
1892
                ),
1893
                __FILE__,
1894
                __FUNCTION__,
1895
                __LINE__
1896
            );
1897
            $success = false;
1898
        }
1899
        if ($success) {
1900
            $success = $status === 'off'
1901
                ? $message_template_group->deactivate_context($this->_req_data['context'])

core/business/EE_Registration_Processor.class.php 1 location

@@ 721-732 (lines=12) @@
718
        );
719
        // grab the related ticket object for this line_item
720
        $ticket = $line_item->ticket();
721
        if (! $ticket instanceof EE_Ticket) {
722
            EE_Error::add_error(
723
                sprintf(
724
                    esc_html__('Line item %s did not contain a valid ticket', 'event_espresso'),
725
                    $line_item->ID()
726
                ),
727
                __FILE__,
728
                __FUNCTION__,
729
                __LINE__
730
            );
731
            return null;
732
        }
733
        $registration_service = new CreateRegistrationService();
734
        // then generate a new registration from that
735
        return $registration_service->create(

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

@@ 1054-1068 (lines=15) @@
1051
                    // add relation to registration, set attendee ID, and cache attendee
1052
                    $this->_associate_attendee_with_registration($registration, $attendee);
1053
                    // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );
1054
                    if (! $registration->attendee() instanceof EE_Attendee) {
1055
                        EE_Error::add_error(
1056
                            sprintf(
1057
                                esc_html__(
1058
                                    'Registration %s has an invalid or missing Attendee object.',
1059
                                    'event_espresso'
1060
                                ),
1061
                                $reg_url_link
1062
                            ),
1063
                            __FILE__,
1064
                            __FUNCTION__,
1065
                            __LINE__
1066
                        );
1067
                        return false;
1068
                    }
1069
                    /** @type EE_Registration_Processor $registration_processor */
1070
                    $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1071
                    // at this point, we should have enough details about the registrant to consider the registration

core/db_classes/EE_Base_Class.class.php 1 location

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

core/admin/EE_Admin_Page.core.php 1 location

@@ 1387-1402 (lines=16) @@
1384
                                                             . $tour
1385
                                                             . '.class.php' : $file_path;
1386
                    //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1387
                    if (! is_readable($file_path)) {
1388
                        EE_Error::add_error(
1389
                            sprintf(
1390
                                esc_html__(
1391
                                    'The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling',
1392
                                    'event_espresso'
1393
                                ),
1394
                                $file_path,
1395
                                $tour
1396
                            ),
1397
                            __FILE__,
1398
                            __FUNCTION__,
1399
                            __LINE__
1400
                        );
1401
                        return;
1402
                    }
1403
                    require_once $file_path;
1404
                    if (! class_exists($tour)) {
1405
                        $error_msg[] = sprintf(

admin_pages/transactions/Transactions_Admin_Page.core.php 1 location

@@ 470-479 (lines=10) @@
467
            : null;
468
        $this->_transaction->verify_abandoned_transaction_status();
469
470
        if (! $this->_transaction instanceof EE_Transaction) {
471
            $error_msg = sprintf(
472
                esc_html__(
473
                    'An error occurred and the details for the transaction with the ID # %d could not be retrieved.',
474
                    'event_espresso'
475
                ),
476
                $TXN_ID
477
            );
478
            EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
479
        }
480
    }
481
482