Skip to content

Commit b4736a4

Browse files
Remove overkill type checking for transient response
Co-authored-by: felixarntz <[email protected]>
1 parent ddc6164 commit b4736a4

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

plugins/optimization-detective/site-health.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,8 @@ function od_compose_site_health_result( $response ): array {
167167
*/
168168
function od_get_rest_api_health_check_response( bool $use_cached ) {
169169
$transient_key = 'od_rest_api_health_check_response';
170-
$response = $use_cached ? get_transient( $transient_key ) : null;
171-
if (
172-
(
173-
is_array( $response )
174-
&&
175-
isset( $response['response']['code'], $response['response']['message'], $response['body'] )
176-
&&
177-
is_int( $response['response']['code'] )
178-
&&
179-
is_string( $response['response']['message'] )
180-
&&
181-
is_string( $response['body'] )
182-
)
183-
||
184-
is_wp_error( $response )
185-
) {
170+
$response = $use_cached ? get_transient( $transient_key ) : false;
171+
if ( false !== $response ) {
186172
return $response;
187173
}
188174
$rest_url = get_rest_url( null, OD_REST_API_NAMESPACE . OD_URL_METRICS_ROUTE );

0 commit comments

Comments
 (0)