Code Duplication    Length = 3-10 lines in 3 locations

_inc/lib/core-api/class.jetpack-core-api-site-endpoints.php 1 location

@@ 34-40 (lines=7) @@
31
		$results = json_decode( $response['body'], true );
32
33
		// Bail if there were no results or plan details returned
34
		if ( ! is_array( $results ) ) {
35
			return new WP_Error(
36
				'failed_to_fetch_data',
37
				esc_html__( 'Unable to fetch the requested data.', 'jetpack' ),
38
				array( 'status' => 500 )
39
			);
40
		}
41
42
		return rest_ensure_response( array(
43
				'code' => 'success',

_inc/lib/class.core-rest-api-endpoints.php 1 location

@@ 836-838 (lines=3) @@
833
		$param = $request->get_params();
834
835
		// Exit if no parameters were passed.
836
		if ( ! is_array( $param ) ) {
837
			return new WP_Error( 'missing_setting', esc_html__( 'Missing setting.', 'jetpack' ), array( 'status' => 404 ) );
838
		}
839
840
		// Get option name and value.
841
		$option = key( $param );

_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php 1 location

@@ 1591-1600 (lines=10) @@
1588
		}
1589
1590
		$verification_services_codes = get_option( 'verification_services_codes' );
1591
		if (
1592
			! is_array( $verification_services_codes )
1593
			|| empty( $verification_services_codes )
1594
		) {
1595
			return new WP_Error(
1596
				'empty',
1597
				esc_html__( 'Site not verified with any service.', 'jetpack' ),
1598
				array( 'status' => 404 )
1599
			);
1600
		}
1601
1602
		$services = array();
1603
		foreach ( jetpack_verification_services() as $name => $service ) {