diff --git a/src/api/class-jw-player-api.php b/src/api/class-jw-player-api.php index c782f3e..c1e2319 100644 --- a/src/api/class-jw-player-api.php +++ b/src/api/class-jw-player-api.php @@ -79,17 +79,13 @@ public function request_url( string $last_modified_date, int $batch_size ): stri * @return array */ public function request_args( string $type = '' ): array { - $default_args = [ + return [ 'user-agent' => $this->user_agent(), 'headers' => [ 'Authorization' => 'Bearer ' . $this->api_secret, 'Content-Type' => 'application/json', ], ]; - - return 'vip' === $type - ? $default_args - : array_merge( $default_args, [ 'timeout' => 3 ] ); } /** @@ -147,12 +143,17 @@ public function request_latest_videos( string $updated_after, int $batch_size ): 3, 5, 3, - $this->request_args( 'vip' ) + $this->request_args() ); } else { $api_request = wp_remote_get( $request_url, - $this->request_args() + wp_parse_args( + $this->request_args(), + [ + 'timeout' => 3, + ] + ) ); }