Code Duplication    Length = 13-13 lines in 2 locations

core/helpers/EEH_File.helper.php 2 locations

@@ 229-241 (lines=13) @@
226
			if(	! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
227
				return false;
228
			}
229
			if ( ! EEH_File::verify_is_writable( $parent_folder, 'folder' )) {
230
				return false;
231
			} else {
232
				if ( ! $wp_filesystem->mkdir( EEH_File::convert_local_filepath_to_remote_filepath(  $folder ) ) ) {
233
					if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
234
						$msg = sprintf( __( '"%s" could not be created.', 'event_espresso' ), $folder );
235
						$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $folder );
236
						throw new EE_Error( $msg );
237
					}
238
					return false;
239
				}
240
				EEH_File::add_index_file( $folder );
241
			}
242
		} elseif ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
243
			return false;
244
		}
@@ 287-299 (lines=13) @@
284
		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
285
		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
286
		$parent_folder = EEH_File::get_parent_folder( $full_file_path );
287
		if ( ! EEH_File::exists( $full_file_path )) {
288
			if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
289
				return false;
290
			}
291
			if ( ! $wp_filesystem->touch( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) {
292
				if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
293
					$msg = sprintf( __( 'The "%s" file could not be created.', 'event_espresso' ), $full_file_path );
294
					$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
295
					throw new EE_Error( $msg );
296
				}
297
				return false;
298
			}
299
		}
300
		if ( ! EEH_File::verify_is_writable( $full_file_path, 'file' )) {
301
			return false;
302
		}