Code Duplication    Length = 13-13 lines in 3 locations

json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php 1 location

@@ 391-403 (lines=13) @@
388
		}
389
390
		// Set sharing status of the post
391
		if ( $new ) {
392
			$sharing_enabled = isset( $sharing ) ? (bool) $sharing : true;
393
			if ( false === $sharing_enabled ) {
394
				update_post_meta( $post_id, 'sharing_disabled', 1 );
395
			}
396
		}
397
		else {
398
			if ( isset( $sharing ) && true === $sharing ) {
399
				delete_post_meta( $post_id, 'sharing_disabled' );
400
			} else if ( isset( $sharing ) && false == $sharing ) {
401
				update_post_meta( $post_id, 'sharing_disabled', 1 );
402
			}
403
		}
404
405
		if ( isset( $sticky ) ) {
406
			if ( true === $sticky ) {

json-endpoints/class.wpcom-json-api-update-post-endpoint.php 1 location

@@ 378-390 (lines=13) @@
375
		}
376
377
		// Set sharing status of the post
378
		if ( $new ) {
379
			$sharing_enabled = isset( $sharing ) ? (bool) $sharing : true;
380
			if ( false === $sharing_enabled ) {
381
				update_post_meta( $post_id, 'sharing_disabled', 1 );
382
			}
383
		}
384
		else {
385
			if ( isset( $sharing ) && true === $sharing ) {
386
				delete_post_meta( $post_id, 'sharing_disabled' );
387
			} else if ( isset( $sharing ) && false == $sharing ) {
388
				update_post_meta( $post_id, 'sharing_disabled', 1 );
389
			}
390
		}
391
392
		if ( isset( $sticky ) ) {
393
			if ( true === $sticky ) {

json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php 1 location

@@ 391-403 (lines=13) @@
388
		}
389
390
		// Set sharing status of the post
391
		if ( $new ) {
392
			$sharing_enabled = isset( $sharing ) ? (bool) $sharing : true;
393
			if ( false === $sharing_enabled ) {
394
				update_post_meta( $post_id, 'sharing_disabled', 1 );
395
			}
396
		}
397
		else {
398
			if ( isset( $sharing ) && true === $sharing ) {
399
				delete_post_meta( $post_id, 'sharing_disabled' );
400
			} else if ( isset( $sharing ) && false == $sharing ) {
401
				update_post_meta( $post_id, 'sharing_disabled', 1 );
402
			}
403
		}
404
405
		if ( isset( $sticky ) ) {
406
			if ( true === $sticky ) {