Code Duplication    Length = 12-12 lines in 2 locations

packages/mc-stats/src/class-mc-stats.php 1 location

@@ 139-150 (lines=12) @@
136
	 *
137
	 * @return bool If it worked.
138
	 */
139
	public function do_server_side_stat( $url ) {
140
		$response = wp_remote_get( esc_url_raw( $url ) );
141
		if ( is_wp_error( $response ) ) {
142
			return false;
143
		}
144
145
		if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
146
			return false;
147
		}
148
149
		return true;
150
	}
151
152
	/**
153
	 * Builds the stats url.

class.jetpack.php 1 location

@@ 4612-4623 (lines=12) @@
4609
	 *
4610
	 * @return bool If it worked.
4611
	 */
4612
	static function do_server_side_stat( $args ) {
4613
		$response = wp_remote_get( esc_url_raw( self::build_stats_url( $args ) ) );
4614
		if ( is_wp_error( $response ) ) {
4615
			return false;
4616
		}
4617
4618
		if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
4619
			return false;
4620
		}
4621
4622
		return true;
4623
	}
4624
4625
	/**
4626
	 * Builds the stats url.