/** * @param string $dir The directory to hash * @throws \InvalidArgumentException If the directory is not readable */ public function __construct(string $dir) { $this->dir = Fs::dir($dir); if (!$this->dir->test(Fs::EXISTS | Fs::READABLE)) { throw new \InvalidArgumentException(sprintf("failed to hash directory; %s", $this->dir->getError())); } }