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