mangaRepository->findAll( page: $query->page, limit: $query->limit, sortBy: $query->sortBy, sortOrder: $query->sortOrder ); $total = $this->mangaRepository->count(); $chapterCounts = []; foreach ($mangas as $manga) { $id = $manga->getId()->getValue(); $chapterCounts[$id] = [ 'total' => $this->mangaRepository->countChapters($id), 'scraped' => $this->mangaRepository->countAvailableChapters($id), ]; } return new MangaListResponse( mangas: $mangas, total: $total, page: $query->page, limit: $query->limit, chapterCounts: $chapterCounts ); } }