diff --git a/composer.json b/composer.json index caf5e5dd..53a469fe 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "laminas/laminas-paginator": "^2.8", "laminas/laminas-servicemanager": "^3.4", "laminas/laminas-stdlib": "^3.2", - "lcobucci/jwt": "^4.0@beta", + "lcobucci/jwt": "^4.0", "league/uri": "^6.2", "lstrojny/functional-php": "^1.9", "mezzio/mezzio": "^3.2", diff --git a/module/Core/src/Paginator/Adapter/ShortUrlRepositoryAdapter.php b/module/Core/src/Paginator/Adapter/ShortUrlRepositoryAdapter.php index f395412c..59d48a82 100644 --- a/module/Core/src/Paginator/Adapter/ShortUrlRepositoryAdapter.php +++ b/module/Core/src/Paginator/Adapter/ShortUrlRepositoryAdapter.php @@ -19,12 +19,6 @@ class ShortUrlRepositoryAdapter implements AdapterInterface $this->params = $params; } - /** - * Returns a collection of items for a page. - * - * @param int $offset Page offset - * @param int $itemCountPerPage Number of items per page - */ public function getItems($offset, $itemCountPerPage): array // phpcs:ignore { return $this->repository->findList( @@ -37,15 +31,6 @@ class ShortUrlRepositoryAdapter implements AdapterInterface ); } - /** - * Count elements of an object - * @link http://php.net/manual/en/countable.count.php - * @return int The custom count as an integer. - *

- *

- * The return value is cast to an integer. - * @since 5.1.0 - */ public function count(): int { return $this->repository->countList( diff --git a/module/Core/src/Repository/ShortUrlRepository.php b/module/Core/src/Repository/ShortUrlRepository.php index 27dac54b..95e50f40 100644 --- a/module/Core/src/Repository/ShortUrlRepository.php +++ b/module/Core/src/Repository/ShortUrlRepository.php @@ -33,15 +33,9 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI ?DateRange $dateRange = null ): array { $qb = $this->createListQueryBuilder($searchTerm, $tags, $dateRange); - $qb->select('DISTINCT s'); - - // Set limit and offset - if ($limit !== null) { - $qb->setMaxResults($limit); - } - if ($offset !== null) { - $qb->setFirstResult($offset); - } + $qb->select('DISTINCT s') + ->setMaxResults($limit) + ->setFirstResult($offset); // In case the ordering has been specified, the query could be more complex. Process it if ($orderBy !== null && $orderBy->hasOrderField()) { @@ -147,7 +141,7 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI WHERE s.shortCode = :shortCode AND (s.domain IS NULL OR d.authority = :domain) ORDER BY s.domain {$ordering} -DQL; + DQL; $query = $this->getEntityManager()->createQuery($dql); $query->setMaxResults(1) @@ -220,9 +214,8 @@ DQL; } if ($meta->hasValidUntil()) { $qb->andWhere($qb->expr()->eq('s.validUntil', ':validUntil')) - ->setParameter('validUntil', $meta->getValidUntil()); + ->setParameter('validUntil', $meta->getValidUntil()); } - if ($meta->hasDomain()) { $qb->join('s.domain', 'd') ->andWhere($qb->expr()->eq('d.authority', ':domain'))