Code Duplication    Length = 3-10 lines in 3 locations

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

@@ 800-802 (lines=3) @@
797
		$param = $request->get_params();
798
799
		// Exit if no parameters were passed.
800
		if ( ! is_array( $param ) ) {
801
			return new WP_Error( 'missing_setting', esc_html__( 'Missing setting.', 'jetpack' ), array( 'status' => 404 ) );
802
		}
803
804
		// Get option name and value.
805
		$option = key( $param );

_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/core-api/class.jetpack-core-api-module-endpoints.php 1 location

@@ 1499-1508 (lines=10) @@
1496
		}
1497
1498
		$verification_services_codes = get_option( 'verification_services_codes' );
1499
		if (
1500
			! is_array( $verification_services_codes )
1501
			|| empty( $verification_services_codes )
1502
		) {
1503
			return new WP_Error(
1504
				'empty',
1505
				esc_html__( 'Site not verified with any service.', 'jetpack' ),
1506
				array( 'status' => 404 )
1507
			);
1508
		}
1509
1510
		$services = array();
1511
		foreach ( jetpack_verification_services() as $name => $service ) {