From 052c1cde21aa5275a79b7e4b43470f643748bc0b Mon Sep 17 00:00:00 2001 From: Thibault Dockx <thibault.dockx@fusiondirectory.org> Date: Tue, 25 Mar 2025 16:20:52 +0000 Subject: [PATCH] :art: Refactor(WebServiceCall) - clean up code formatting and update .gitignore for IDE files --- .gitignore | 8 ++++++ src/FusionDirectory/Rest/WebServiceCall.php | 32 ++++++++++----------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 6ef5c6d..824d16b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,10 @@ .directory +filelist +phpstan-baseline.neon +phpstan.neon +.idea/.gitignore +.idea/fusiondirectory-integrator.iml +.idea/modules.xml +.idea/php.xml +.idea/vcs.xml diff --git a/src/FusionDirectory/Rest/WebServiceCall.php b/src/FusionDirectory/Rest/WebServiceCall.php index ebbeef7..0ef7029 100644 --- a/src/FusionDirectory/Rest/WebServiceCall.php +++ b/src/FusionDirectory/Rest/WebServiceCall.php @@ -77,7 +77,7 @@ class WebServiceCall if (!empty($this->data)) { curl_setopt($this->ch, CURLOPT_POSTFIELDS, json_encode($this->data)); } - + curl_setopt($this->ch, CURLOPT_USERAGENT, $customUserAgent); break; } @@ -206,12 +206,12 @@ class WebServiceCall return $response; } -/** - * @return array - * @throws \Exception - */ -public function execute(): array -{ + /** + * @return array + * @throws \Exception + */ + public function execute (): array + { $response = curl_exec($this->ch); // Capture the HTTP status code @@ -225,7 +225,7 @@ public function execute(): array return []; // Return an empty array for 204 responses } - $decoded = json_decode($response, true); + $decoded = json_decode($response, TRUE); curl_close($this->ch); if (!is_array($decoded)) { @@ -233,16 +233,16 @@ public function execute(): array } return $decoded; -} + } -/** - * Retrieve the HTTP status code of the last request - * @return int - */ -public function getHttpStatusCode(): int -{ + /** + * Retrieve the HTTP status code of the last request + * @return int + */ + public function getHttpStatusCode (): int + { return $this->httpStatusCode; -} + } } -- GitLab