Code Duplication    Length = 22-22 lines in 2 locations

lib/controller.php 2 locations

@@ 175-196 (lines=22) @@
172
	 *
173
	 * @return boolean
174
	 */
175
	public function export_post( $post_id ) {
176
		if ( wp_is_post_revision( $post_id ) ) {
177
			return;
178
		}
179
180
		if ( ! $this->app->semaphore()->is_open() ) {
181
			return $this->app->response()->error( new WP_Error(
182
				'semaphore_locked',
183
				sprintf( __( '%s : Semaphore is locked, import/export already in progress.', 'writing-on-github' ), 'Controller::export_post()' )
184
			) );
185
		}
186
187
		$this->app->semaphore()->lock();
188
		$result = $this->app->export()->update( $post_id );
189
		$this->app->semaphore()->unlock();
190
191
		if ( is_wp_error( $result ) ) {
192
            /* @var WP_Error $result */
193
			return $this->app->response()->error( $result );
194
		}
195
196
		return $this->app->response()->success( $result );
197
	}
198
199
	/**
@@ 208-229 (lines=22) @@
205
	 *
206
	 * @return boolean
207
	 */
208
	public function delete_post( $post_id ) {
209
		if ( wp_is_post_revision( $post_id ) ) {
210
			return;
211
		}
212
213
		if ( ! $this->app->semaphore()->is_open() ) {
214
			return $this->app->response()->error( new WP_Error(
215
				'semaphore_locked',
216
				sprintf( __( '%s : Semaphore is locked, import/export already in progress.', 'writing-on-github' ), 'Controller::delete_post()' )
217
			) );
218
		}
219
220
		$this->app->semaphore()->lock();
221
		$result = $this->app->export()->delete( $post_id );
222
		$this->app->semaphore()->unlock();
223
224
		if ( is_wp_error( $result ) ) {
225
            /* @var WP_Error $result */
226
			return $this->app->response()->error( $result );
227
		}
228
229
		return $this->app->response()->success( $result );
230
	}
231
232
	/**