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`
@@ 1067-1076 (lines=10) @@
1064
		}
1065
1066
		$verification_services_codes = get_option( 'verification_services_codes' );
1067
		if (
1068
			! is_array( $verification_services_codes )
1069
			|| empty( $verification_services_codes )
1070
		) {
1071
			return new WP_Error(
1072
				'empty',
1073
				esc_html__( 'Site not verified with any service.', 'jetpack' ),
1074
				array( 'status' => 404 )
1075
			);
1076
		}
1077
1078
		$services = array();
1079
		foreach ( jetpack_verification_services() as $name => $service ) {