Code Duplication    Length = 3-10 lines in 3 locations

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

@@ 623-625 (lines=3) @@
620
		$param = $request->get_params();
621
622
		// Exit if no parameters were passed.
623
		if ( ! is_array( $param ) ) {
624
			return new WP_Error( 'missing_setting', esc_html__( 'Missing setting.', 'jetpack' ), array( 'status' => 404 ) );
625
		}
626
627
		// Get option name and value.
628
		$option = key( $param );

_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php 2 locations

@@ 485-487 (lines=3) @@
482
		}
483
484
		// Exit if no parameters were passed.
485
		if ( ! is_array( $params ) ) {
486
			return new WP_Error( 'missing_options', esc_html__( 'Missing options.', 'jetpack' ), array( 'status' => 404 ) );
487
		}
488
489
		// If $params was set via `get_body_params()` there may be some additional variables in the request that can
490
		// cause validation to fail. This method verifies that each param was in fact updated and will throw a `some_updated`
@@ 1238-1247 (lines=10) @@
1235
		}
1236
1237
		$verification_services_codes = get_option( 'verification_services_codes' );
1238
		if (
1239
			! is_array( $verification_services_codes )
1240
			|| empty( $verification_services_codes )
1241
		) {
1242
			return new WP_Error(
1243
				'empty',
1244
				esc_html__( 'Site not verified with any service.', 'jetpack' ),
1245
				array( 'status' => 404 )
1246
			);
1247
		}
1248
1249
		$services = array();
1250
		foreach ( jetpack_verification_services() as $name => $service ) {