/** * @param string $slug * @return Recipe * @throws RecipeNotFoundException */ public function fetchBySlug($slug) { if (!$this->filesystem->has($this->generateFileNameFromSlug($slug))) { throw new RecipeNotFoundException(sprintf("Recipe with slug \"%s\" does not exists", $slug)); } $json = $this->filesystem->read($this->generateFileNameFromSlug($slug)); return $this->serializer->deserialize($json, Recipe::class); }