| @@ 186-201 (lines=16) @@ | ||
| 183 | /** |
|
| 184 | * {@inheritdoc} |
|
| 185 | */ |
|
| 186 | public function allocateStream(BucketInterface $bucket, $name) |
|
| 187 | { |
|
| 188 | try { |
|
| 189 | $response = $this->client->send($this->buildRequest('GET', $bucket, $name)); |
|
| 190 | } catch (ClientException $exception) { |
|
| 191 | if ($exception->getCode() == 401) { |
|
| 192 | $this->reconnect(); |
|
| 193 | ||
| 194 | return $this->allocateStream($bucket, $name); |
|
| 195 | } |
|
| 196 | ||
| 197 | throw new ServerException($exception->getMessage(), $exception->getCode(), $exception); |
|
| 198 | } |
|
| 199 | ||
| 200 | return $response->getBody(); |
|
| 201 | } |
|
| 202 | ||
| 203 | /** |
|
| 204 | * {@inheritdoc} |
|
| @@ 206-219 (lines=14) @@ | ||
| 203 | /** |
|
| 204 | * {@inheritdoc} |
|
| 205 | */ |
|
| 206 | public function delete(BucketInterface $bucket, $name) |
|
| 207 | { |
|
| 208 | try { |
|
| 209 | $this->client->send($this->buildRequest('DELETE', $bucket, $name)); |
|
| 210 | } catch (ClientException $exception) { |
|
| 211 | if ($exception->getCode() == 401) { |
|
| 212 | $this->reconnect(); |
|
| 213 | $this->delete($bucket, $name); |
|
| 214 | } elseif ($exception->getCode() != 404) { |
|
| 215 | throw new ServerException($exception->getMessage(), $exception->getCode(), |
|
| 216 | $exception); |
|
| 217 | } |
|
| 218 | } |
|
| 219 | } |
|
| 220 | ||
| 221 | /** |
|
| 222 | * {@inheritdoc} |
|