Code Duplication    Length = 12-12 lines in 2 locations

src/MyOrganizers/ReadModel/Doctrine/DBALLookupService.php 1 location

@@ 80-91 (lines=12) @@
77
        // if the amount of rows on the first page does not reach the limit.
78
        $onFirstPage = $queryBuilder->getFirstResult() === 0;
79
        $hasSinglePage = $itemCount < $queryBuilder->getMaxResults();
80
        if ($onFirstPage && $hasSinglePage) {
81
            $totalItems = $itemCount;
82
        } else {
83
            $q = $this->connection->createQueryBuilder();
84
85
            $totalItems = $q->resetQueryParts()->select('COUNT(*) AS total')
86
                ->from($this->tableName->toNative())
87
                ->where($itemIsOwnedByUser)
88
                ->setParameters($parameters)
89
                ->execute()
90
                ->fetchColumn(0);
91
        }
92
93
        return new PartOfCollection($organizers, new Natural($totalItems));
94
    }

src/ReadModel/Index/Doctrine/DBALRepository.php 1 location

@@ 367-378 (lines=12) @@
364
        // if the amount of rows on the first page does not reach the limit.
365
        $onFirstPage = $queryBuilder->getFirstResult() === 0;
366
        $hasSinglePage = $itemCount < $queryBuilder->getMaxResults();
367
        if ($onFirstPage && $hasSinglePage) {
368
            $totalItems = $itemCount;
369
        } else {
370
            $q = $this->connection->createQueryBuilder();
371
372
            $totalItems = $q->resetQueryParts()->select('COUNT(*) AS total')
373
                ->from($this->tableName->toNative())
374
                ->where($filterExpression)
375
                ->setParameters($parameters)
376
                ->execute()
377
                ->fetchColumn(0);
378
        }
379
380
        return new Results(
381
            OfferIdentifierCollection::fromArray($offerIdentifierArray),