| @@ 100-114 (lines=15) @@ | ||
| 97 | * |
|
| 98 | * @return array|bool |
|
| 99 | */ |
|
| 100 | public function writeStream($path, $resource, Config $config) |
|
| 101 | { |
|
| 102 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 103 | ||
| 104 | $response = Cosapi::upload($this->getBucket(), $uri, $path, |
|
| 105 | null, null, $config->get('insertOnly', 1)); |
|
| 106 | ||
| 107 | $response = $this->normalizeResponse($response); |
|
| 108 | ||
| 109 | if (false !== $response) { |
|
| 110 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 111 | } |
|
| 112 | ||
| 113 | return $response; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * @param string $path |
|
| @@ 150-164 (lines=15) @@ | ||
| 147 | * |
|
| 148 | * @return array|bool |
|
| 149 | */ |
|
| 150 | public function updateStream($path, $resource, Config $config) |
|
| 151 | { |
|
| 152 | $uri = stream_get_meta_data($resource)['uri']; |
|
| 153 | ||
| 154 | $response = Cosapi::upload($this->getBucket(), $uri, $path, |
|
| 155 | null, null, $config->get('insertOnly', 0)); |
|
| 156 | ||
| 157 | $response = $this->normalizeResponse($response); |
|
| 158 | ||
| 159 | if (false !== $response) { |
|
| 160 | $this->setContentType($path, stream_get_contents($resource)); |
|
| 161 | } |
|
| 162 | ||
| 163 | return $response; |
|
| 164 | } |
|
| 165 | ||
| 166 | /** |
|
| 167 | * @param string $path |
|