Skip to content

Commit

Permalink
Fix "It is recommended not to use reserved keyword "array" as".
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed May 15, 2024
1 parent 21f05ac commit a71a7e4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ class Response {
*
* @var array<string, mixed>
*/
private $array;
private $data;

/**
* Construct response array.
*
* @param array<string, mixed> $array WordPress remote request response array.
* @param array<string, mixed> $data WordPress remote request response array.
*/
public function __construct( $array ) {
$this->array = $array;
public function __construct( $data ) {
$this->data = $data;
}

/**
Expand All @@ -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 );
}

/**
Expand All @@ -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 );
}

/**
Expand All @@ -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 );
}

/**
Expand All @@ -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 ) )
)
);
}
Expand All @@ -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() )
),
Expand Down Expand Up @@ -173,7 +173,7 @@ public function simplexml() {
* @return array<string, mixed>
*/
public function get_array() {
return $this->array;
return $this->data;
}

/**
Expand Down

0 comments on commit a71a7e4

Please sign in to comment.