Code Duplication    Length = 10-16 lines in 8 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

@@ 1057-1071 (lines=15) @@
1054
                    // add relation to registration, set attendee ID, and cache attendee
1055
                    $this->_associate_attendee_with_registration($registration, $attendee);
1056
                    // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );
1057
                    if (! $registration->attendee() instanceof EE_Attendee) {
1058
                        EE_Error::add_error(
1059
                            sprintf(
1060
                                esc_html__(
1061
                                    'Registration %s has an invalid or missing Attendee object.',
1062
                                    'event_espresso'
1063
                                ),
1064
                                $reg_url_link
1065
                            ),
1066
                            __FILE__,
1067
                            __FUNCTION__,
1068
                            __LINE__
1069
                        );
1070
                        return false;
1071
                    }
1072
                    /** @type EE_Registration_Processor $registration_processor */
1073
                    $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1074
                    // 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

core/EE_Session.core.php 1 location

@@ 545-557 (lines=13) @@
542
            return false;
543
        }
544
        foreach ($data as $key => $value) {
545
            if (isset($this->_default_session_vars[ $key ])) {
546
                EE_Error::add_error(
547
                    sprintf(
548
                        esc_html__(
549
                            'Sorry! %s is a default session datum and can not be reset.',
550
                            'event_espresso'
551
                        ),
552
                        $key
553
                    ),
554
                    __FILE__, __FUNCTION__, __LINE__
555
                );
556
                return false;
557
            }
558
            $this->_session_data[ $key ] = $value;
559
        }
560
        return true;

modules/ticket_selector/ProcessTicketSelector.php 1 location

@@ 435-447 (lines=13) @@
432
                            );
433
                        }
434
                    }
435
                    if ($valid_ticket !== true) {
436
                        // nothing added to cart retrieved
437
                        EE_Error::add_error(
438
                            sprintf(
439
                                esc_html__(
440
                                    'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.',
441
                                    'event_espresso'
442
                                ),
443
                                '<br/>'
444
                            ),
445
                            __FILE__, __FUNCTION__, __LINE__
446
                        );
447
                    }
448
                    if (EE_Error::has_error()) {
449
                        break;
450
                    }