GetRankingPoints   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 1
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VideoGamesRecords\CoreBundle\Controller\Group\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\Group;
12
use VideoGamesRecords\CoreBundle\Ranking\Provider\Player\PlayerGroupRankingProvider;
13
14
class GetRankingPoints extends AbstractController
15
{
16
    private RankingProviderInterface $rankingProvider;
17
18
    public function __construct(
19
        #[Autowire(service: PlayerGroupRankingProvider::class)]
20
        RankingProviderInterface $rankingProvider
21
    ) {
22
        $this->rankingProvider = $rankingProvider;
23
    }
24
25
    /**
26
     * @param Group   $group
27
     * @param Request $request
28
     * @return array
29
     */
30
    public function __invoke(Group $group, Request $request): array
31
    {
32
        return $this->rankingProvider->getRankingPoints(
33
            $group->getId(),
34
            [
35
                'maxRank' => $request->query->get('maxRank', '5'),
36
                'idTeam' => $request->query->get('idTeam'),
37
                'user' => $this->getUser()
38
            ]
39
        );
40
    }
41
}
42