GetRankingPoints   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
c 0
b 0
f 0
dl 0
loc 22
rs 10

2 Methods

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