| @@ 38-55 (lines=18) @@ | ||
| 35 | /** |
|
| 36 | * {@inheritdoc} |
|
| 37 | */ |
|
| 38 | public function read($key) |
|
| 39 | { |
|
| 40 | try { |
|
| 41 | $result = $this->adapter->read($key); |
|
| 42 | } catch (\Exception $e) { |
|
| 43 | if ($e instanceof FileNotFoundException) { |
|
| 44 | throw new FileNotFound($key, $e->getCode(), $e); |
|
| 45 | } |
|
| 46 | ||
| 47 | throw StorageFailure::unexpectedFailure('read', ['key' => $key], $e); |
|
| 48 | } |
|
| 49 | ||
| 50 | if (false === $result) { |
|
| 51 | throw StorageFailure::unexpectedFailure('read', ['key' => $key]); |
|
| 52 | } |
|
| 53 | ||
| 54 | return $result['contents']; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * {@inheritdoc} |
|
| @@ 141-158 (lines=18) @@ | ||
| 138 | /** |
|
| 139 | * {@inheritdoc} |
|
| 140 | */ |
|
| 141 | public function mtime($key) |
|
| 142 | { |
|
| 143 | try { |
|
| 144 | $result = $this->adapter->getTimestamp($key); |
|
| 145 | } catch (\Exception $e) { |
|
| 146 | if ($e instanceof FileNotFoundException) { |
|
| 147 | throw new FileNotFound($key, $e->getCode(), $e); |
|
| 148 | } |
|
| 149 | ||
| 150 | throw StorageFailure::unexpectedFailure('mtime', ['key' => $key], $e); |
|
| 151 | } |
|
| 152 | ||
| 153 | if (false === $result) { |
|
| 154 | throw StorageFailure::unexpectedFailure('mtime', ['key' => $key]); |
|
| 155 | } |
|
| 156 | ||
| 157 | return $result; |
|
| 158 | } |
|
| 159 | ||
| 160 | /** |
|
| 161 | * {@inheritdoc} |
|
| @@ 163-178 (lines=16) @@ | ||
| 160 | /** |
|
| 161 | * {@inheritdoc} |
|
| 162 | */ |
|
| 163 | public function delete($key) |
|
| 164 | { |
|
| 165 | try { |
|
| 166 | $result = $this->adapter->delete($key); |
|
| 167 | } catch (\Exception $e) { |
|
| 168 | if ($e instanceof FileNotFoundException) { |
|
| 169 | throw new FileNotFound($key, $e->getCode(), $e); |
|
| 170 | } |
|
| 171 | ||
| 172 | throw StorageFailure::unexpectedFailure('delete', ['key' => $key], $e); |
|
| 173 | } |
|
| 174 | ||
| 175 | if (false === $result) { |
|
| 176 | throw StorageFailure::unexpectedFailure('delete', ['key' => $key]); |
|
| 177 | } |
|
| 178 | } |
|
| 179 | ||
| 180 | /** |
|
| 181 | * {@inheritdoc} |
|