diff --git a/src/api/class-jw-player-api.php b/src/api/class-jw-player-api.php index ea2cdfd..aa03512 100644 --- a/src/api/class-jw-player-api.php +++ b/src/api/class-jw-player-api.php @@ -44,6 +44,9 @@ class JW_Player_API implements API_Requester { /** * Constructor. + * + * @param string $api_key The API key. + * @param string $api_secret The API secret. */ public function __construct( string $api_key, string $api_secret ) { $this->api_key = $api_key; @@ -86,7 +89,7 @@ public function get_request_url(): string { */ public function get_request_args(): array { return [ - 'headers' => [ + 'headers' => [ 'Authorization' => 'Bearer ' . $this->api_secret, 'Content-Type' => 'application/json', ], @@ -96,7 +99,7 @@ public function get_request_args(): array { /** * Parse the API error response. * - * @param mixed $response_object The API response object. + * @param array $response_object The API response object. * * @return array */ @@ -109,7 +112,7 @@ public function parse_error( array $response_object ): array { /** * Parse the API successful response. * - * @param mixed $response_object The API response object. + * @param array $response_object The API response object. * * @return array */ diff --git a/src/api/class-request.php b/src/api/class-request.php index 307beff..ba2fadc 100644 --- a/src/api/class-request.php +++ b/src/api/class-request.php @@ -9,6 +9,9 @@ use Alley\WP\WP_Video_Sync\Interfaces\API_Requester; +/** + * Perform an API request. + */ class Request { /** @@ -25,8 +28,6 @@ class Request { */ public function __construct( API_Requester $api_requester ) { $this->api_requester = $api_requester; - - return $this; } /** @@ -58,7 +59,7 @@ public function get_request_args(): array { /** * Parse the API response. * - * @param mixed $response + * @param mixed $response The API response. * @return array */ private function parse_response( mixed $response ): array { @@ -99,7 +100,7 @@ public function get(): array { $this->get_request_args() ); } else { - $api_request = wp_remote_get( + $api_request = wp_remote_get( // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get $this->api_requester->get_request_url(), $this->get_request_args() );