Code Duplication    Length = 3-10 lines in 3 locations

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

@@ 601-603 (lines=3) @@
598
		$param = $request->get_params();
599
600
		// Exit if no parameters were passed.
601
		if ( ! is_array( $param ) ) {
602
			return new WP_Error( 'missing_setting', esc_html__( 'Missing setting.', 'jetpack' ), array( 'status' => 404 ) );
603
		}
604
605
		// Get option name and value.
606
		$option = key( $param );

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

@@ 433-435 (lines=3) @@
430
		}
431
432
		// Exit if no parameters were passed.
433
		if ( ! is_array( $params ) ) {
434
			return new WP_Error( 'missing_options', esc_html__( 'Missing options.', 'jetpack' ), array( 'status' => 404 ) );
435
		}
436
437
		// If $params was set via `get_body_params()` there may be some additional variables in the request that can
438
		// cause validation to fail. This method verifies that each param was in fact updated and will throw a `some_updated`
@@ 1040-1049 (lines=10) @@
1037
		}
1038
1039
		$verification_services_codes = get_option( 'verification_services_codes' );
1040
		if (
1041
			! is_array( $verification_services_codes )
1042
			|| empty( $verification_services_codes )
1043
		) {
1044
			return new WP_Error(
1045
				'empty',
1046
				esc_html__( 'Site not verified with any service.', 'jetpack' ),
1047
				array( 'status' => 404 )
1048
			);
1049
		}
1050
1051
		$services = array();
1052
		foreach ( jetpack_verification_services() as $name => $service ) {