|null ...$filters * @return AbstractListDto */ public function bornListDto( int $page, int $limit, ?array $filters ): AbstractListDto { $filters['news_category'] = $filters[0]; if (!$this->validate->isValidUuid($filters['news_category'])) { $filters['news_category'] = null; } $this->validate->correctPagination($page, $limit); $countOfNews = $this->news->getCountWithFilters( $filters['news_category'] ); $pagination = $this->paginationFactory->create( $page, $limit, $countOfNews ); $offset = min( $pagination->pageSize, $countOfNews ) * ($pagination->currentPage - 1); $list = $this->listFactory->createCollection( $this->news->getWithFilters( $filters['news_category'], $limit, $offset ) ); $filters = $this->filterFactory->create( $this->categoryFactory->createCollection( $this->newsCategories->getAll() ) ); return $this->listingFactory->create( $pagination, $list, $filters ); } public function bornMainNews(): NewsListingElementDto { return $this->listFactory->create($this->news->getMainNews()); } public function bornDetailMainNews(): NewsDetailElementDto { return $this->detailElementFactory->create($this->news->getMainNews()); } public function bornDetailElement(string $detailId): NewsDetailElementDto { if (!$this->validate->isValidUuid($detailId)) { throw new NonValidUuidError(); } $news = $this->news->find($detailId); if ($news === null) { throw new NotFoundError('News not found'); } return $this->detailElementFactory->create($news); } }