Code Duplication    Length = 13-13 lines in 3 locations

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

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

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

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

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

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