/** * @return \Generator */ public function fetchAll() { $slugs = $this->filesystem->foldersNames('/'); foreach ($slugs as $slug) { if ($this->filesystem->has($this->generateFileNameFromSlug($slug))) { (yield $this->fetchBySlug($slug)); } } }
/** * @param $slug * @return bool */ public function hasImageFor($slug) { $path = $this->generateBasePath($slug); $filePath = $this->composeJpgFilePath($slug, $path); return $this->filesystem->has($filePath); }