Code Duplication    Length = 9-9 lines in 5 locations

modules/enerscore/wp-enerscore-api.php 1 location

@@ 46-54 (lines=9) @@
43
		 * @param mixed $request Request URL.
44
		 * @return $body Body.
45
		 */
46
		private function fetch( $request ) {
47
			$response = wp_remote_get( $request );
48
			$code = wp_remote_retrieve_response_code( $response );
49
			if ( 200 !== $code ) {
50
				return new WP_Error( 'response-error', sprintf( __( 'Server response code: %d', 'text-domain' ), $code ) );
51
			}
52
			$body = wp_remote_retrieve_body( $response );
53
			return json_decode( $body );
54
		}
55
		/**
56
		 * Get Energy Score for Address.
57
		 *

modules/greatschools/wp-greatschools-api.php 1 location

@@ 62-70 (lines=9) @@
59
		 * @param mixed $request Request URL.
60
		 * @return $body Body.
61
		 */
62
		private function fetch( $request ) {
63
			$response = wp_remote_get( $request );
64
			$code = wp_remote_retrieve_response_code( $response );
65
			if ( 200 !== $code ) {
66
				return new WP_Error( 'response-error', sprintf( __( 'Server response code: %d', 'text-domain' ), $code ) );
67
			}
68
			$body = wp_remote_retrieve_body( $response );
69
			return $body;
70
		}
71
		/**
72
		 * get_schools function.
73
		 *

modules/streetadvisor/wp-streetadvisor-api.php 1 location

@@ 59-67 (lines=9) @@
56
		 * @param mixed $request Request URL.
57
		 * @return $body Body.
58
		 */
59
		private function fetch( $request ) {
60
			$response = wp_remote_get( $request, $this->args );
61
			$code = wp_remote_retrieve_response_code( $response );
62
			if ( 200 !== $code ) {
63
				return new WP_Error( 'response-error', sprintf( __( 'Server response code: %d', 'text-domain' ), $code ) );
64
			}
65
			$body = wp_remote_retrieve_body( $response );
66
			return json_decode( $body, true );
67
		}
68
		/**
69
		 * Get Location Data.
70
		 *

modules/walkscore/wp-walkscore-api.php 1 location

@@ 61-69 (lines=9) @@
58
		 * @param mixed $request Request URL.
59
		 * @return $body Body.
60
		 */
61
		private function fetch( $request ) {
62
			$response = wp_remote_get( $request );
63
			$code = wp_remote_retrieve_response_code( $response );
64
			if ( 200 !== $code ) {
65
				return new WP_Error( 'response-error', sprintf( __( 'Server response code: %d', 'text-domain' ), $code ) );
66
			}
67
			$body = wp_remote_retrieve_body( $response );
68
			return json_decode( $body );
69
		}
70
		/**
71
		 * Get Walkscore (https://www.walkscore.com/professional/api.php)
72
		 *

modules/zillow/wp-zillow-api.php 1 location

@@ 63-71 (lines=9) @@
60
		 * @param mixed $request Request URL.
61
		 * @return $body Body.
62
		 */
63
		private function fetch( $request ) {
64
			$response = wp_remote_get( $request );
65
			$code = wp_remote_retrieve_response_code( $response );
66
			if ( 200 !== $code ) {
67
				return new WP_Error( 'response-error', sprintf( __( 'Server response code: %d', 're-pro' ), $code ) );
68
			}
69
			$body = wp_remote_retrieve_body( $response );
70
			return json_decode( $body );
71
		}
72
		/**
73
		 * Get Zillow Reviews (https://www.zillow.com/howto/api/ReviewsAPI.htm)
74
		 *