GetRankingMedals   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

2 Methods

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