| @@ 79-91 (lines=13) @@ | ||
| 76 | /** |
|
| 77 | * {@inheritdoc} |
|
| 78 | */ |
|
| 79 | public function copy($path, $newpath) |
|
| 80 | { |
|
| 81 | $path = $this->applyPathPrefix($path); |
|
| 82 | $newpath = $this->applyPathPrefix($newpath); |
|
| 83 | ||
| 84 | try { |
|
| 85 | $this->client->copy($path, $newpath); |
|
| 86 | } catch (BadRequest $e) { |
|
| 87 | return false; |
|
| 88 | } |
|
| 89 | ||
| 90 | return true; |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * {@inheritdoc} |
|
| @@ 120-131 (lines=12) @@ | ||
| 117 | /** |
|
| 118 | * {@inheritdoc} |
|
| 119 | */ |
|
| 120 | public function createDir($dirname, Config $config) |
|
| 121 | { |
|
| 122 | $path = $this->applyPathPrefix($dirname); |
|
| 123 | ||
| 124 | try { |
|
| 125 | $object = $this->client->createFolder($path); |
|
| 126 | } catch (BadRequest $e) { |
|
| 127 | return false; |
|
| 128 | } |
|
| 129 | ||
| 130 | return $this->normalizeResponse($object); |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * {@inheritdoc} |
|
| @@ 160-171 (lines=12) @@ | ||
| 157 | /** |
|
| 158 | * {@inheritdoc} |
|
| 159 | */ |
|
| 160 | public function readStream($path) |
|
| 161 | { |
|
| 162 | $path = $this->applyPathPrefix($path); |
|
| 163 | ||
| 164 | try { |
|
| 165 | $stream = $this->client->download($path); |
|
| 166 | } catch (BadRequest $e) { |
|
| 167 | return false; |
|
| 168 | } |
|
| 169 | ||
| 170 | return compact('stream'); |
|
| 171 | } |
|
| 172 | ||
| 173 | /** |
|
| 174 | * {@inheritdoc} |
|
| @@ 196-207 (lines=12) @@ | ||
| 193 | /** |
|
| 194 | * {@inheritdoc} |
|
| 195 | */ |
|
| 196 | public function getMetadata($path) |
|
| 197 | { |
|
| 198 | $path = $this->applyPathPrefix($path); |
|
| 199 | ||
| 200 | try { |
|
| 201 | $object = $this->client->getMetadata($path); |
|
| 202 | } catch (BadRequest $e) { |
|
| 203 | return false; |
|
| 204 | } |
|
| 205 | ||
| 206 | return $this->normalizeResponse($object); |
|
| 207 | } |
|
| 208 | ||
| 209 | /** |
|
| 210 | * {@inheritdoc} |
|
| @@ 265-276 (lines=12) @@ | ||
| 262 | * |
|
| 263 | * @return array|false file metadata |
|
| 264 | */ |
|
| 265 | protected function upload($path, $contents, $mode) |
|
| 266 | { |
|
| 267 | $path = $this->applyPathPrefix($path); |
|
| 268 | ||
| 269 | try { |
|
| 270 | $object = $this->client->upload($path, $contents, $mode); |
|
| 271 | } catch (BadRequest $e) { |
|
| 272 | return false; |
|
| 273 | } |
|
| 274 | ||
| 275 | return $this->normalizeResponse($object); |
|
| 276 | } |
|
| 277 | } |
|
| 278 | ||