llowed parameters. $allowed_params = [ 'email', 'lcp', 'ttfb', 'cls', 'tbt', 'global_score', 'enabled_options', 'language', 'limit', 'version', ]; $query_params = []; foreach ( $allowed_params as $key ) { if ( isset( $params[ $key ] ) && '' !== $params[ $key ] ) { $query_params[ $key ] = $params[ $key ]; } } return $query_params; } /** * Validate response structure. * * @param array $response Response data. * @return bool True if valid, false otherwise. */ public function validate_response( array $response ): bool { if ( ! isset( $response['recommendations'] ) || ! is_array( $response['recommendations'] ) ) { return false; } // Must have 'metadata' key (array). if ( ! isset( $response['metadata'] ) || ! is_array( $response['metadata'] ) ) { return false; } return true; } /** * Force this value to be true for the Job Manager to consider the request successful because this APIClient won't be used in queue. * * @param array $response Response data. * @return bool */ public function validate_add_to_queue_response( array $response ): bool { return true; } }