| @@ 78-90 (lines=13) @@ | ||
| 75 | /** |
|
| 76 | * {@inheritdoc} |
|
| 77 | */ |
|
| 78 | public function copy($path, $newpath) |
|
| 79 | { |
|
| 80 | $path = $this->applyPathPrefix($path); |
|
| 81 | $newpath = $this->applyPathPrefix($newpath); |
|
| 82 | ||
| 83 | try { |
|
| 84 | $this->client->copy($path, $newpath); |
|
| 85 | } catch (\Exception $e) { |
|
| 86 | return false; |
|
| 87 | } |
|
| 88 | ||
| 89 | return true; |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * {@inheritdoc} |
|
| @@ 119-130 (lines=12) @@ | ||
| 116 | /** |
|
| 117 | * {@inheritdoc} |
|
| 118 | */ |
|
| 119 | public function createDir($dirname, Config $config) |
|
| 120 | { |
|
| 121 | $path = $this->applyPathPrefix($dirname); |
|
| 122 | ||
| 123 | try { |
|
| 124 | $object = $this->client->createFolder($path); |
|
| 125 | } catch (\Exception $e) { |
|
| 126 | return false; |
|
| 127 | } |
|
| 128 | ||
| 129 | return $this->normalizeResponse($object); |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * {@inheritdoc} |
|
| @@ 159-172 (lines=14) @@ | ||
| 156 | /** |
|
| 157 | * {@inheritdoc} |
|
| 158 | */ |
|
| 159 | public function readStream($path) |
|
| 160 | { |
|
| 161 | $path = $this->applyPathPrefix($path); |
|
| 162 | ||
| 163 | try { |
|
| 164 | $stream = $this->client->download($path); |
|
| 165 | ||
| 166 | return compact('stream'); |
|
| 167 | } catch (\Exception $e) { |
|
| 168 | // |
|
| 169 | } |
|
| 170 | ||
| 171 | return false; |
|
| 172 | } |
|
| 173 | ||
| 174 | /** |
|
| 175 | * {@inheritdoc} |
|
| @@ 197-210 (lines=14) @@ | ||
| 194 | /** |
|
| 195 | * {@inheritdoc} |
|
| 196 | */ |
|
| 197 | public function getMetadata($path) |
|
| 198 | { |
|
| 199 | $path = $this->applyPathPrefix($path); |
|
| 200 | ||
| 201 | try { |
|
| 202 | $object = $this->client->getMetadata($path); |
|
| 203 | ||
| 204 | return $this->normalizeResponse($object); |
|
| 205 | } catch (\Exception $e) { |
|
| 206 | // |
|
| 207 | } |
|
| 208 | ||
| 209 | return false; |
|
| 210 | } |
|
| 211 | ||
| 212 | /** |
|
| 213 | * {@inheritdoc} |
|
| @@ 291-304 (lines=14) @@ | ||
| 288 | * |
|
| 289 | * @return array|false file metadata |
|
| 290 | */ |
|
| 291 | protected function upload($path, $contents, $mode) |
|
| 292 | { |
|
| 293 | $path = $this->applyPathPrefix($path); |
|
| 294 | ||
| 295 | try { |
|
| 296 | $object = $this->client->upload($path, $contents, $mode); |
|
| 297 | ||
| 298 | return $this->normalizeResponse($object); |
|
| 299 | } catch (\Exception $e) { |
|
| 300 | // |
|
| 301 | } |
|
| 302 | ||
| 303 | return false; |
|
| 304 | } |
|
| 305 | } |
|
| 306 | ||