| Total Complexity | 6 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class ApplicationRepository extends DocumentRepository |
||
| 11 | { |
||
| 12 | public function search(User $user, int $page = 1, string $query = null, int $size = 20) |
||
| 13 | { |
||
| 14 | $skip = ($page * $size) - $size; |
||
| 15 | $skip = $skip < 0 ? 0 : $skip; |
||
| 16 | |||
| 17 | $qb = $this->createQueryBuilder() |
||
| 18 | ->limit($size) |
||
| 19 | ->skip($skip); |
||
| 20 | |||
| 21 | $this->addSearch($qb, $user, $query); |
||
| 22 | |||
| 23 | return $qb->getQuery()->execute(); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function count(User $user, string $query = null) |
||
| 27 | { |
||
| 28 | $qb = $this->createQueryBuilder()->count(); |
||
| 29 | $this->addSearch($qb, $user, $query); |
||
| 30 | |||
| 31 | return $qb->getQuery()->execute(); |
||
| 32 | } |
||
| 33 | |||
| 34 | private function addSearch(Builder $qb, User $user, string $query = null, string $type = null): void |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.