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

GetRankingPoints   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 7 1
1
<?php
2
3
namespace VideoGamesRecords\CoreBundle\Controller\Serie\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\Serie;
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 Serie   $serie
21
     * @param Request $request
22
     * @return array
23
     */
24
    public function __invoke(Serie $serie, Request $request): array
25
    {
26
        return $this->rankingProvider->getRankingPoints(
27
            $serie->getId(),
28
            [
29
                'maxRank' => $request->query->get('maxRank', 100),
30
                'limit' => $request->query->get('limit', 100),
31
            ]
32
        );
33
    }
34
}
35