19 declare(strict_types=1);
40 $this->storage_dir = $storage_base_dir;
41 if (!is_dir($this->storage_dir)) {
42 throw new \InvalidArgumentException(
'Storage directory does not exist');
57 $path = $stream->getMetadata(
'uri');
67 strpos($path, $this->storage_dir) ===
false 68 || !is_readable($path)
69 || !file_exists($path)
71 throw new \InvalidArgumentException(
"Invalid access key or path");
75 private function hash(
string $string): string
77 return bin2hex($string);
80 private function unhash(
string $string): string
82 return hex2bin($string);
__construct(string $storage_base_dir)
fromAccessKey(string $access_key)
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
fromFileStream(FileStream $stream)