Code Duplication    Length = 2-8 lines in 4 locations

core/admin/EE_Admin_Page_Loader.core.php 1 location

@@ 240-241 (lines=2) @@
237
		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238
		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239
		foreach ( $this->_admin_menu_groups as $group ) {
240
			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
242
			$groups[$group->menu_slug] = $group;
243
		}
244
		return $groups;

core/helpers/EEH_DTT_Helper.helper.php 1 location

@@ 408-415 (lines=8) @@
405
	 * @throws \EE_Error
406
	 */
407
	protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) {
408
		if ( ! $DateTime instanceof DateTime ) {
409
			throw new EE_Error(
410
				sprintf(
411
					__( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ),
412
					print_r( $DateTime, true )
413
				)
414
			);
415
		}
416
		switch ( $period ) {
417
			case 'years' :
418
				$value = 'P' . $value . 'Y';

core/db_models/EEM_Base.model.php 2 locations

@@ 4125-4127 (lines=3) @@
4122
		}elseif( $primary_key_field instanceof EE_Primary_Key_String_Field && is_string($base_class_obj_or_id) ){
4123
			//assume its a string representation of the object
4124
			$model_object = $this->get_one_by_ID($base_class_obj_or_id);
4125
		}else{
4126
			throw new EE_Error(sprintf(__("'%s' is neither an object of type %s, nor an ID! Its full value is '%s'",'event_espresso'),$base_class_obj_or_id,$this->_get_class_name(),print_r($base_class_obj_or_id,true)));
4127
		}
4128
		if( $model_object->ID() == NULL && $ensure_is_in_db){
4129
			$model_object->save();
4130
		}
@@ 4155-4157 (lines=3) @@
4152
		}elseif(is_string($base_class_obj_or_id)){
4153
			//assume its a string representation of the object
4154
			$id = $base_class_obj_or_id;
4155
		}else{
4156
			throw new EE_Error(sprintf(__("'%s' is neither an object of type %s, nor an ID! Its full value is '%s'",'event_espresso'),$base_class_obj_or_id,$this->_get_class_name(),print_r($base_class_obj_or_id,true)));
4157
		}
4158
		return $id;
4159
	}
4160