| @@ 270-281 (lines=12) @@ | ||
| 267 | * |
|
| 268 | * @throws \InvalidArgumentException If $key is invalid |
|
| 269 | */ |
|
| 270 | public function checksum($key) |
|
| 271 | { |
|
| 272 | self::assertValidKey($key); |
|
| 273 | ||
| 274 | $this->assertHasFile($key); |
|
| 275 | ||
| 276 | if ($this->adapter instanceof Adapter\ChecksumCalculator) { |
|
| 277 | return $this->adapter->checksum($key); |
|
| 278 | } |
|
| 279 | ||
| 280 | return Util\Checksum::fromContent($this->read($key)); |
|
| 281 | } |
|
| 282 | ||
| 283 | /** |
|
| 284 | * Returns the size of the specified file's content. |
|
| @@ 292-303 (lines=12) @@ | ||
| 289 | * |
|
| 290 | * @throws \InvalidArgumentException If $key is invalid |
|
| 291 | */ |
|
| 292 | public function size($key) |
|
| 293 | { |
|
| 294 | self::assertValidKey($key); |
|
| 295 | ||
| 296 | $this->assertHasFile($key); |
|
| 297 | ||
| 298 | if ($this->adapter instanceof Adapter\SizeCalculator) { |
|
| 299 | return $this->adapter->size($key); |
|
| 300 | } |
|
| 301 | ||
| 302 | return Util\Size::fromContent($this->read($key)); |
|
| 303 | } |
|
| 304 | ||
| 305 | /** |
|
| 306 | * Gets a new stream instance of the specified file. |
|