/** * Save the plain data into a file and hash the resulting filename. * * Note: Overwrites old files and uses existing subdirectories. * * @param Result $result * * @return Result */ public function execute(Result $result) { $subDir = $this->dir . DIRECTORY_SEPARATOR . substr($result->getHash(), 0, 1); $saveTo = $subDir . DIRECTORY_SEPARATOR . $result->getHash(); $fs = new Filesystem(); $fs->dumpFile($saveTo, $result->getData()); return $result; }