Code Duplication    Length = 10-10 lines in 3 locations

lib/export.php 2 locations

@@ 46-55 (lines=10) @@
43
44
        $error = false;
45
46
        foreach ( $posts as $post ) {
47
            $result = $this->update( $post->id() );
48
            if ( is_wp_error( $result ) ) {
49
                if ( $error ) {
50
                    $error->add( $result->get_error_code(), $result->get_error_message() );
51
                } else {
52
                    $error = $result;
53
                }
54
            }
55
        }
56
57
        if ( is_wp_error( $error ) ) {
58
            return $error;
@@ 126-135 (lines=10) @@
123
124
		$persist = $this->app->api()->persist();
125
126
		foreach ( $posts as $post ) {
127
			$result = $this->new_post( $post, $persist );
128
			if ( is_wp_error( $result ) ) {
129
				if ( $error ) {
130
					$error->add( $result->get_error_code(), $result->get_error_message() );
131
				} else {
132
					$error = $result;
133
				}
134
			}
135
		}
136
137
		if ( is_wp_error( $error ) ) {
138
			return $error;

lib/import.php 1 location

@@ 73-82 (lines=10) @@
70
		}
71
72
		if ( $delete_ids ) {
73
			foreach ($delete_ids as $id) {
74
				$result = $this->app->database()->delete_post( $id );
75
				if ( is_wp_error( $result ) ) {
76
					if ( $error ) {
77
						$error->add( $result->get_error_code(), $result->get_error_message() );
78
					} else {
79
						$error = $result;
80
					}
81
				}
82
			}
83
		}
84
85
		return $error;