feat: mise à jour de la gestion des chapitres en remplaçant les types d'identifiants par des flottants pour une meilleure cohérence, ajout de la documentation pour les méthodes de recherche de chapitres, et amélioration de la gestion des exceptions lors de la récupération des chapitres.
This commit is contained in:
parent
5928cfd5f0
commit
c0bd9c69b1
@@ -4,6 +4,7 @@ namespace App\Tests\Domain\Scraping\Adapter;
|
||||
|
||||
use App\Domain\Scraping\Domain\Contract\Repository\ChapterRepositoryInterface;
|
||||
use App\Domain\Scraping\Domain\Model\Chapter;
|
||||
use App\Domain\Scraping\Domain\Exception\ChapterNotFoundException;
|
||||
|
||||
class InMemoryChapterRepository implements ChapterRepositoryInterface
|
||||
{
|
||||
@@ -14,7 +15,7 @@ class InMemoryChapterRepository implements ChapterRepositoryInterface
|
||||
return $this->chapters[$id] ?? null;
|
||||
}
|
||||
|
||||
public function getByMangaIdAndChapterNumber(string $mangaId, int $chapterNumber): Chapter
|
||||
public function getByMangaIdAndChapterNumber(string $mangaId, float $chapterNumber): Chapter
|
||||
{
|
||||
foreach ($this->chapters as $chapter) {
|
||||
if ($chapter->mangaId === $mangaId && $chapter->chapterNumber === $chapterNumber) {
|
||||
@@ -22,7 +23,7 @@ class InMemoryChapterRepository implements ChapterRepositoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
throw new \RuntimeException('Chapter not found');
|
||||
throw new ChapterNotFoundException();
|
||||
}
|
||||
|
||||
public function save(Chapter $chapter): void
|
||||
|
||||
Reference in New Issue
Block a user