Code Duplication    Length = 3-4 lines in 3 locations

projects/plugins/jetpack/class.jetpack.php 1 location

@@ 6202-6204 (lines=3) @@
6199
	 */
6200
	public static function normalize_url_protocol_agnostic( $url ) {
6201
		$parsed_url = wp_parse_url( trailingslashit( esc_url_raw( $url ) ) );
6202
		if ( ! $parsed_url || empty( $parsed_url['host'] ) || empty( $parsed_url['path'] ) ) {
6203
			return new WP_Error( 'cannot_parse_url', sprintf( esc_html__( 'Cannot parse URL %s', 'jetpack' ), $url ) );
6204
		}
6205
6206
		// Strip www and protocols
6207
		$url = preg_replace( '/^www\./i', '', $parsed_url['host'] . $parsed_url['path'] );

projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php 1 location

@@ 144-146 (lines=3) @@
141
		add_menu_page( __( 'My Home', 'jetpack' ), __( 'My Home', 'jetpack' ), $cap, $menu_slug, null, 'dashicons-admin-home', 2 );
142
143
		// Only add submenu when there are other submenu items.
144
		if ( ! empty( $submenu['index.php'] ) ) {
145
			add_submenu_page( $menu_slug, __( 'My Home', 'jetpack' ), __( 'My Home', 'jetpack' ), $cap, $menu_slug, null, 1 );
146
		}
147
148
		$this->migrate_submenus( 'index.php', $menu_slug );
149
		add_filter(

projects/packages/connection/src/class-manager.php 1 location

@@ 2369-2372 (lines=4) @@
2366
				return $suppress_errors ? false : new \WP_Error( 'no_token_for_user', sprintf( __( 'No token for user %d', 'jetpack' ), $user_id ) );
2367
			}
2368
			$user_token_chunks = explode( '.', $user_tokens[ $user_id ] );
2369
			if ( empty( $user_token_chunks[1] ) || empty( $user_token_chunks[2] ) ) {
2370
				// translators: %s is the user ID.
2371
				return $suppress_errors ? false : new \WP_Error( 'token_malformed', sprintf( __( 'Token for user %d is malformed', 'jetpack' ), $user_id ) );
2372
			}
2373
			if ( $user_token_chunks[2] !== (string) $user_id ) {
2374
				// translators: %1$d is the ID of the requested user. %2$d is the user ID found in the token.
2375
				return $suppress_errors ? false : new \WP_Error( 'user_id_mismatch', sprintf( __( 'Requesting user_id %1$d does not match token user_id %2$d', 'jetpack' ), $user_id, $user_token_chunks[2] ) );