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

GetRankingPoints   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
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 20
rs 10

2 Methods

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