| @@ 157-170 (lines=14) @@ | ||
| 154 | * |
|
| 155 | * @return string |
|
| 156 | */ |
|
| 157 | public function read($key) |
|
| 158 | { |
|
| 159 | self::assertValidKey($key); |
|
| 160 | ||
| 161 | $this->assertHasFile($key); |
|
| 162 | ||
| 163 | $content = $this->adapter->read($key); |
|
| 164 | ||
| 165 | if (false === $content) { |
|
| 166 | throw new \RuntimeException(sprintf('Could not read the "%s" key content.', $key)); |
|
| 167 | } |
|
| 168 | ||
| 169 | return $content; |
|
| 170 | } |
|
| 171 | ||
| 172 | /** |
|
| 173 | * Deletes the file matching the specified key. |
|
| @@ 182-195 (lines=14) @@ | ||
| 179 | * |
|
| 180 | * @return bool |
|
| 181 | */ |
|
| 182 | public function delete($key) |
|
| 183 | { |
|
| 184 | self::assertValidKey($key); |
|
| 185 | ||
| 186 | $this->assertHasFile($key); |
|
| 187 | ||
| 188 | if ($this->adapter->delete($key)) { |
|
| 189 | $this->removeFromRegister($key); |
|
| 190 | ||
| 191 | return true; |
|
| 192 | } |
|
| 193 | ||
| 194 | throw new \RuntimeException(sprintf('Could not remove the "%s" key.', $key)); |
|
| 195 | } |
|
| 196 | ||
| 197 | /** |
|
| 198 | * Returns an array of all keys. |
|