public function generate() { if (!$this->filesystem->exists($path = $this->getPath())) { return $this->filesystem->put($path, $this->getContents()); } throw new FileAlreadyExistException('File already exists!'); }