From a71a7e4301c924712714690553c1e5360d9909e9 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 15 May 2024 15:20:02 +0200 Subject: [PATCH] Fix "It is recommended not to use reserved keyword "array" as". --- src/Response.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Response.php b/src/Response.php index 0f6dd1c..6d03b0d 100644 --- a/src/Response.php +++ b/src/Response.php @@ -24,15 +24,15 @@ class Response { * * @var array */ - private $array; + private $data; /** * Construct response array. * - * @param array $array WordPress remote request response array. + * @param array $data WordPress remote request response array. */ - public function __construct( $array ) { - $this->array = $array; + public function __construct( $data ) { + $this->data = $data; } /** @@ -42,7 +42,7 @@ public function __construct( $array ) { * @return int|string */ public function status() { - return \wp_remote_retrieve_response_code( $this->array ); + return \wp_remote_retrieve_response_code( $this->data ); } /** @@ -52,7 +52,7 @@ public function status() { * @return string */ public function message() { - return \wp_remote_retrieve_response_message( $this->array ); + return \wp_remote_retrieve_response_message( $this->data ); } /** @@ -62,7 +62,7 @@ public function message() { * @return string */ public function body() { - return \wp_remote_retrieve_body( $this->array ); + return \wp_remote_retrieve_body( $this->data ); } /** @@ -87,8 +87,8 @@ public function json() { throw new \Exception( \sprintf( 'Response is empty, HTTP response: "%s %s".', - \esc_html( \wp_remote_retrieve_response_code( $this->array ) ), - \esc_html( \wp_remote_retrieve_response_message( $this->array ) ) + \esc_html( \wp_remote_retrieve_response_code( $this->data ) ), + \esc_html( \wp_remote_retrieve_response_message( $this->data ) ) ) ); } @@ -103,8 +103,8 @@ public function json() { throw new \Exception( \sprintf( 'Could not JSON decode response, HTTP response: "%s %s", HTTP body length: "%d", JSON error: "%s".', - \esc_html( \wp_remote_retrieve_response_code( $this->array ) ), - \esc_html( \wp_remote_retrieve_response_message( $this->array ) ), + \esc_html( \wp_remote_retrieve_response_code( $this->data ) ), + \esc_html( \wp_remote_retrieve_response_message( $this->data ) ), \esc_html( \strlen( $body ) ), \esc_html( \json_last_error_msg() ) ), @@ -173,7 +173,7 @@ public function simplexml() { * @return array */ public function get_array() { - return $this->array; + return $this->data; } /**