Passed
Push — develop ( 03e02c...0276b7 )
by BENARD
04:36
created

GetRankingMedals   A

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
namespace VideoGamesRecords\CoreBundle\Controller\Team;
4
5
use Doctrine\ORM\Exception\ORMException;
6
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
7
use Symfony\Component\HttpFoundation\Request;
8
use VideoGamesRecords\CoreBundle\Ranking\Provider\Team\TeamRankingProvider;
9
10
class GetRankingMedals extends AbstractController
11
{
12
    private TeamRankingProvider $teamRankingProvider;
13
14
    public function __construct(TeamRankingProvider $teamRankingProvider)
15
    {
16
        $this->teamRankingProvider = $teamRankingProvider;
17
    }
18
19
    /**
20
     * @param Request $request
21
     * @return array
22
     * @throws ORMException
23
     */
24
    public function __invoke(Request $request): array
25
    {
26
        return $this->teamRankingProvider->getRankingMedals(
27
            [
28
                'maxRank' => $request->query->get('maxRank', 5),
29
            ]
30
        );
31
    }
32
}
33