| @@ 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 | ||
| 86 | return true; |
|
| 87 | } catch (\Exception $e) { |
|
| 88 | return false; |
|
| 89 | } |
|
| 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 | ||
| 126 | return $this->normalizeResponse($object); |
|
| 127 | } catch (\Exception $exception) { |
|
| 128 | return false; |
|
| 129 | } |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * {@inheritdoc} |
|
| @@ 158-171 (lines=14) @@ | ||
| 155 | /** |
|
| 156 | * {@inheritdoc} |
|
| 157 | */ |
|
| 158 | public function readStream($path) |
|
| 159 | { |
|
| 160 | $path = $this->applyPathPrefix($path); |
|
| 161 | ||
| 162 | try { |
|
| 163 | $stream = $this->client->download($path); |
|
| 164 | ||
| 165 | return compact('stream'); |
|
| 166 | } catch (\Exception $exception) { |
|
| 167 | return false; |
|
| 168 | } |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * {@inheritdoc} |
|
| 173 | */ |
|
| 174 | public function listContents($directory = '', $recursive = false) |
|
| @@ 192-205 (lines=14) @@ | ||
| 189 | /** |
|
| 190 | * {@inheritdoc} |
|
| 191 | */ |
|
| 192 | public function getMetadata($path) |
|
| 193 | { |
|
| 194 | $path = $this->applyPathPrefix($path); |
|
| 195 | ||
| 196 | try { |
|
| 197 | $object = $this->client->getMetadata($path); |
|
| 198 | ||
| 199 | return $this->normalizeResponse($object); |
|
| 200 | } catch (\Exception $exception) { |
|
| 201 | return false; |
|
| 202 | } |
|
| 203 | } |
|
| 204 | ||
| 205 | /** |
|
| 206 | * {@inheritdoc} |
|
| 207 | */ |
|
| 208 | public function getSize($path) |
|
| @@ 264-277 (lines=14) @@ | ||
| 261 | * |
|
| 262 | * @return array|false file metadata |
|
| 263 | */ |
|
| 264 | protected function upload($path, $contents, $mode) |
|
| 265 | { |
|
| 266 | $path = $this->applyPathPrefix($path); |
|
| 267 | ||
| 268 | try { |
|
| 269 | $object = $this->client->upload($path, $contents, $mode); |
|
| 270 | ||
| 271 | return $this->normalizeResponse($object); |
|
| 272 | } catch (\Exception $e) { |
|
| 273 | return false; |
|
| 274 | } |
|
| 275 | } |
|
| 276 | } |
|
| 277 | ||