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