From 662a72bbe4d3b9f94c0f8c97be59beb25d0a5309 Mon Sep 17 00:00:00 2001 From: Matthias Treuberg <1148760+mtreuberg@users.noreply.github.com> Date: Thu, 2 May 2024 17:06:39 +0200 Subject: [PATCH] fix order of params because optional parameter should be last (#26) * fix order of params because optional parameter should be last * fix indentation --- src/Request/FluentRequest.php | 12 ++++++------ src/Request/WebHelper.php | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Request/FluentRequest.php b/src/Request/FluentRequest.php index f6e527e..a2257bc 100644 --- a/src/Request/FluentRequest.php +++ b/src/Request/FluentRequest.php @@ -125,7 +125,7 @@ public function execute() { default: throw new \Exception("No appropriate HTTP method found for this request."); } - + return $this->handleResponse($response); } @@ -134,16 +134,16 @@ public function execute() { */ protected function executeFileUpload(string $route, string $filepath) { $endpointUrl = $this->endpointUri."/".$route; - + $this->options[CURLOPT_HTTPHEADER][] = "Api-Key:".$this->credentials->getApiKey(); $webHelper = new WebHelper($this->container); $response = $webHelper->putImageRequest($endpointUrl, $this->requestDetails, - $this->options, - $filepath); - + $filepath, + $this->options); + return $this->handleResponse($response); } @@ -193,4 +193,4 @@ public function withCustomParameter(string $name, string $value) { */ abstract protected function getRoute(); } -} \ No newline at end of file +} diff --git a/src/Request/WebHelper.php b/src/Request/WebHelper.php index df3bab5..c2b5046 100644 --- a/src/Request/WebHelper.php +++ b/src/Request/WebHelper.php @@ -97,11 +97,11 @@ public function put($endpoint, $queryParams, array $options = array(), array $da * Send a PUT requst using cURL * @param string $url to request * @param array $queryParams values to send - * @param array $options for cURL * @param string $filepath of image to add + * @param array $options for cURL * @return string */ - public function putImageRequest($endpoint, $queryParams, array $options = array(), string $filepath) { + public function putImageRequest($endpoint, $queryParams, string $filepath, array $options = array()) { $image = fopen($filepath, "rb");