| @@ 75-89 (lines=15) @@ | ||
| 72 | * |
|
| 73 | * @return array|bool |
|
| 74 | */ |
|
| 75 | public function write($path, $contents, Config $config) |
|
| 76 | { |
|
| 77 | $temporaryPath = $this->createTemporaryFile($contents); |
|
| 78 | ||
| 79 | $response = Cosapi::upload($this->getBucket(), $temporaryPath, $path, |
|
| 80 | null, null, $config->get('insertOnly', 1)); |
|
| 81 | ||
| 82 | $response = $this->normalizeResponse($response); |
|
| 83 | ||
| 84 | if (false !== $response) { |
|
| 85 | $this->setContentType($path, $contents); |
|
| 86 | } |
|
| 87 | ||
| 88 | return $response; |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * @param string $path |
|
| @@ 125-139 (lines=15) @@ | ||
| 122 | * |
|
| 123 | * @return array|bool |
|
| 124 | */ |
|
| 125 | public function update($path, $contents, Config $config) |
|
| 126 | { |
|
| 127 | $temporaryPath = $this->createTemporaryFile($contents); |
|
| 128 | ||
| 129 | $response = Cosapi::upload($this->getBucket(), $temporaryPath, $path, |
|
| 130 | null, null, $config->get('insertOnly', 0)); |
|
| 131 | ||
| 132 | $response = $this->normalizeResponse($response); |
|
| 133 | ||
| 134 | if (false !== $response) { |
|
| 135 | $this->setContentType($path, $contents); |
|
| 136 | } |
|
| 137 | ||
| 138 | return $response; |
|
| 139 | } |
|
| 140 | ||
| 141 | /** |
|
| 142 | * @param string $path |
|