Conditions | 3 |
Paths | 3 |
Total Lines | 24 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function getRankingPoints(int $id = null, array $options = []): array |
||
15 | { |
||
16 | $country = $this->em->getRepository('VideoGamesRecords\CoreBundle\Entity\Country')->find($id); |
||
17 | if (null === $country) { |
||
18 | return []; |
||
19 | } |
||
20 | |||
21 | $maxRank = $options['maxRank'] ?? null; |
||
22 | |||
23 | $query = $this->em->createQueryBuilder('p') |
||
|
|||
24 | ->select('p') |
||
25 | ->from('VideoGamesRecords\CoreBundle\Entity\Player', 'p') |
||
26 | ->where('(p.country = :country)') |
||
27 | ->setParameter('country', $country) |
||
28 | ->orderBy('p.rankCountry'); |
||
29 | |||
30 | if ($maxRank !== null) { |
||
31 | $query->andWhere('p.rankCountry <= :maxRank') |
||
32 | ->setParameter('maxRank', $maxRank); |
||
33 | } else { |
||
34 | $query->setMaxResults($maxRank); |
||
35 | } |
||
36 | |||
37 | return $query->getQuery()->getResult(); |
||
38 | } |
||
50 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.