Passed
Push — develop ( df9e56...fcc4e3 )
by BENARD
12:25
created

GetRanking   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 1
A __construct() 0 3 1
1
<?php
2
3
namespace VideoGamesRecords\CoreBundle\Controller\Country;
4
5
use Doctrine\ORM\Exception\ORMException;
6
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
7
use Symfony\Component\HttpFoundation\Request;
8
use VideoGamesRecords\CoreBundle\Entity\Country;
9
use VideoGamesRecords\CoreBundle\Ranking\Provider\Player\PlayerRankingProvider;
10
11
12
class GetRanking extends AbstractController
13
{
14
15
    public function __construct(
16
        private readonly PlayerRankingProvider $playerRankingProvider)
17
    {
18
    }
19
20
    /**
21
     * @param Country $country
22
     * @param Request $request
23
     * @return array
24
     * @throws ORMException
25
     */
26
    public function __invoke(Country $country, Request $request): array
27
    {
28
        return $this->playerRankingProvider->getRankingCountry(
29
            $country,
30
            [
31
                'maxRank' => $request->query->get('maxRank', '5'),
32
                'idTeam' => $request->query->get('idTeam'),
33
                'limit' => $request->query->get('limit')
34
            ]
35
        );
36
    }
37
}
38