Code Duplication    Length = 13-13 lines in 3 locations

json-endpoints/class.wpcom-json-api-update-post-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-v1-1-endpoint.php 1 location

@@ 458-470 (lines=13) @@
455
		}
456
457
		// Set sharing status of the post
458
		if ( $new ) {
459
			$sharing_enabled = isset( $sharing ) ? (bool) $sharing : true;
460
			if ( false === $sharing_enabled ) {
461
				update_post_meta( $post_id, 'sharing_disabled', 1 );
462
			}
463
		}
464
		else {
465
			if ( isset( $sharing ) && true === $sharing ) {
466
				delete_post_meta( $post_id, 'sharing_disabled' );
467
			} else if ( isset( $sharing ) && false == $sharing ) {
468
				update_post_meta( $post_id, 'sharing_disabled', 1 );
469
			}
470
		}
471
472
		if ( isset( $sticky ) ) {
473
			if ( true === $sticky ) {

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

@@ 459-471 (lines=13) @@
456
		}
457
458
		// Set sharing status of the post
459
		if ( $new ) {
460
			$sharing_enabled = isset( $sharing ) ? (bool) $sharing : true;
461
			if ( false === $sharing_enabled ) {
462
				update_post_meta( $post_id, 'sharing_disabled', 1 );
463
			}
464
		}
465
		else {
466
			if ( isset( $sharing ) && true === $sharing ) {
467
				delete_post_meta( $post_id, 'sharing_disabled' );
468
			} else if ( isset( $sharing ) && false == $sharing ) {
469
				update_post_meta( $post_id, 'sharing_disabled', 1 );
470
			}
471
		}
472
473
		if ( isset( $sticky ) ) {
474
			if ( true === $sticky ) {