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 0
Metric Value
wmc 2
eloc 7
c 0
b 0
f 0
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 1
A __construct() 0 3 1
1
<?php
2
3
namespace VideoGamesRecords\CoreBundle\Controller\Game\Player;
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
11
class GetRankingPoints extends AbstractController
12
{
13
    private RankingProviderInterface $rankingProvider;
14
15
    public function __construct(RankingProviderInterface $rankingProvider)
16
    {
17
        $this->rankingProvider = $rankingProvider;
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
                'idTeam' => $request->query->get('idTeam')
31
            ]
32
        );
33
    }
34
}
35