/** * @return bool */ public function Send() { if (sizeof($this->_files) != 0) { $this->_dto->Merge(array('files' => $this->_files)); } $client = new QuarkClient($this->_config->SMTP(), $this, null, 5); return $client->Connect(); }
/** * @param string $method * @param string $action * @param mixed $data * * @return mixed * @throws QuarkArchException */ private function _api($method, $action, $data = []) { $request = new QuarkDTO(new QuarkJSONIOProcessor()); $request->Method($method); $request->Merge($data); $response = new QuarkDTO(new QuarkJSONIOProcessor()); if (!$this->_uri) { throw new QuarkArchException('QuarkRest API is not reachable. URI is not provided'); } $this->_uri->path = $action; $data = QuarkHTTPTransportClient::To($this->_uri->URI(true), $request, $response); if ($data == null || !isset($data->status) || $data->status != 200) { throw new QuarkArchException('QuarkRest API is not reachable. Response: ' . print_r($data, true)); } return $data; }