Verified Commit 0cc8c68b authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(webservice) - enhance execution method

parent 10ba077c
1 merge request!55Resolve "[Integrator] - Rest library - update to allow easy trigger of archiving objects"
Pipeline #32390 failed with stages
in 47 seconds
Showing with 6 additions and 3 deletions
+6 -3
...@@ -199,19 +199,22 @@ class WebServiceCall ...@@ -199,19 +199,22 @@ class WebServiceCall
return $response; return $response;
} }
/** /**
* @return array * @return array
* @throws Exception * @throws \Exception
*/ */
public function execute(): array public function execute(): array
{ {
$this->setCurlSettings();
$response = curl_exec($this->ch); $response = curl_exec($this->ch);
$this->handleCurlError($this->ch); $this->handleCurlError($this->ch);
$decoded = json_decode($response, true); $decoded = json_decode($response, true);
curl_close($this->ch); curl_close($this->ch);
if (!is_array($decoded)) {
throw new \Exception('Invalid JSON response: ' . $response);
}
return $decoded; return $decoded;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment