| @@ 125-139 (lines=15) @@ | ||
| 122 | * |
|
| 123 | * @return array|bool |
|
| 124 | */ |
|
| 125 | public function writeStream($path, $resource, Config $config) |
|
| 126 | { |
|
| 127 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 128 | ||
| 129 | $response = $this->cosApi->upload($this->getBucket(), $uri, $path, |
|
| 130 | null, null, $config->get('insertOnly', 1)); |
|
| 131 | ||
| 132 | $response = $this->normalizeResponse($response); |
|
| 133 | ||
| 134 | if (false !== $response) { |
|
| 135 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 136 | } |
|
| 137 | ||
| 138 | return $response; |
|
| 139 | } |
|
| 140 | ||
| 141 | /** |
|
| 142 | * @param string $path |
|
| @@ 175-189 (lines=15) @@ | ||
| 172 | * |
|
| 173 | * @return array|bool |
|
| 174 | */ |
|
| 175 | public function updateStream($path, $resource, Config $config) |
|
| 176 | { |
|
| 177 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 178 | ||
| 179 | $response = $this->cosApi->upload($this->getBucket(), $uri, $path, |
|
| 180 | null, null, $config->get('insertOnly', 0)); |
|
| 181 | ||
| 182 | $response = $this->normalizeResponse($response); |
|
| 183 | ||
| 184 | if (false !== $response) { |
|
| 185 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 186 | } |
|
| 187 | ||
| 188 | return $response; |
|
| 189 | } |
|
| 190 | ||
| 191 | /** |
|
| 192 | * @param string $path |
|