| Total Complexity | 4 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class PlayerCountryRankingQuery extends AbstractRankingQuery implements RankingQueryInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @param int|null $id |
||
| 12 | * @param array $options |
||
| 13 | * @return array |
||
| 14 | */ |
||
| 15 | public function getRankingPoints(int $id = null, array $options = []): array |
||
| 16 | { |
||
| 17 | $country = $this->em->getRepository('VideoGamesRecords\CoreBundle\Entity\Country')->find($id); |
||
| 18 | if (null === $country) { |
||
| 19 | return []; |
||
| 20 | } |
||
| 21 | |||
| 22 | $maxRank = $options['maxRank'] ?? null; |
||
| 23 | |||
| 24 | $query = $this->em->createQueryBuilder('p') |
||
|
|
|||
| 25 | ->select('p') |
||
| 26 | ->from('VideoGamesRecords\CoreBundle\Entity\Player', 'p') |
||
| 27 | ->where('(p.country = :country)') |
||
| 28 | ->setParameter('country', $country) |
||
| 29 | ->orderBy('p.rankCountry'); |
||
| 30 | |||
| 31 | if ($maxRank !== null) { |
||
| 32 | $query->andWhere('p.rankCountry <= :maxRank') |
||
| 33 | ->setParameter('maxRank', $maxRank); |
||
| 34 | } else { |
||
| 35 | $query->setMaxResults($maxRank); |
||
| 36 | } |
||
| 37 | |||
| 38 | return $query->getQuery()->getResult(); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param int|null $id |
||
| 43 | * @param array $options |
||
| 44 | * @return array |
||
| 45 | */ |
||
| 46 | public function getRankingMedals(int $id = null, array $options = []): array |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
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.