| @@ 127-143 (lines=17) @@ | ||
| 124 | $this->message = '- Toggl: ' . $message; |
|
| 125 | } |
|
| 126 | ||
| 127 | private function sendApiCall($method, $uri = '', array $options = []) |
|
| 128 | { |
|
| 129 | $res = true; |
|
| 130 | ||
| 131 | try { |
|
| 132 | $response = $this->client->request(strtoupper($method), $uri, $options); |
|
| 133 | $this->code = $response->getStatusCode(); |
|
| 134 | $this->data = json_decode($response->getBody(), true); |
|
| 135 | } catch (ConnectException $e) { |
|
| 136 | $this->setMessage('cannot connect to api!'); |
|
| 137 | $res = false; |
|
| 138 | } catch (ClientException $e) { |
|
| 139 | $this->setMessage($e->getResponse()->getBody()); |
|
| 140 | } |
|
| 141 | ||
| 142 | return $res; |
|
| 143 | } |
|
| 144 | ||
| 145 | private function lastApiCall($status = '') |
|
| 146 | { |
|
| @@ 114-130 (lines=17) @@ | ||
| 111 | $this->message = '- Harvest: ' . $message; |
|
| 112 | } |
|
| 113 | ||
| 114 | private function sendApiCall($method, $uri = '', array $options = []) |
|
| 115 | { |
|
| 116 | $res = true; |
|
| 117 | ||
| 118 | try { |
|
| 119 | $response = $this->client->request(strtoupper($method), $uri, $options); |
|
| 120 | $this->code = $response->getStatusCode(); |
|
| 121 | $this->data = json_decode($response->getBody(), true); |
|
| 122 | } catch (ConnectException $e) { |
|
| 123 | $this->setMessage('cannot connect to api!'); |
|
| 124 | $res = false; |
|
| 125 | } catch (ClientException $e) { |
|
| 126 | $this->setMessage($e->getResponse()->getBody()); |
|
| 127 | } |
|
| 128 | ||
| 129 | return $res; |
|
| 130 | } |
|
| 131 | ||
| 132 | private function lastApiCall($status = '') |
|
| 133 | { |
|