/** * @param string $method * @param string $url * @param array [optional] $params */ public function request($method, $url, $params = []) { $this->httpClient->setUri($this->moduleOptions->getApiUrl() . '/' . ltrim($url, '/')); $this->httpClient->setMethod($method); if (!is_null($params)) { if ($method == 'post' || $method == 'put') { $this->httpClient->setEncType(HttpClient::ENC_FORMDATA); $this->httpClient->setParameterPost($params); } else { $this->httpClient->setEncType(HttpClient::ENC_URLENCODED); $this->httpClient->setParameterGet($params); } } $response = $this->httpClient->send(); $data = json_decode($response->getBody(), true); return $data; }
/** * @param string $uniqueId * * @return string */ protected function getHttpPath($uniqueId) { return $this->moduleOptions->getCollageHttpPath() . '/' . $this->getFileName($uniqueId); }