Code Duplication    Length = 4-5 lines in 3 locations

projects/plugins/jetpack/modules/publicize/publicize.php 3 locations

@@ 539-543 (lines=5) @@
536
				}
537
538
				$unique_id = null;
539
				if ( ! empty( $connection->unique_id ) ) {
540
					$unique_id = $connection->unique_id;
541
				} else if ( ! empty( $connection['connection_data']['token_id'] ) ) {
542
					$unique_id = $connection['connection_data']['token_id'];
543
				}
544
545
				$test_results[] = array(
546
					'connectionID'          => $id,
@@ 1020-1023 (lines=4) @@
1017
					continue;
1018
				}
1019
1020
				if ( !empty( $connection->unique_id ) )
1021
					$unique_id = $connection->unique_id;
1022
				else if ( !empty( $connection['connection_data']['token_id'] ) )
1023
					$unique_id = $connection['connection_data']['token_id'];
1024
1025
				// This was a wp-admin request, so we need to check the state of checkboxes
1026
				if ( $from_web ) {
@@ 1163-1166 (lines=4) @@
1160
			// services have multiple connections.
1161
			foreach ( $connections as $connection ) {
1162
				$unique_id = '';
1163
				if ( ! empty( $connection->unique_id ) )
1164
					$unique_id = $connection->unique_id;
1165
				else if ( ! empty( $connection['connection_data']['token_id'] ) )
1166
					$unique_id = $connection['connection_data']['token_id'];
1167
1168
				// Did we skip this connection?
1169
				if ( get_post_meta( $post_id, $this->POST_SKIP . $unique_id,  true ) ) {