Passed
Push — develop ( f18292...8f15a8 )
by BENARD
05:20
created

GetPositions   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 36
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 35 1
1
<?php
2
3
namespace VideoGamesRecords\DwhBundle\Controller\Player;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6
use Symfony\Component\HttpFoundation\Request;
7
use VideoGamesRecords\DwhBundle\Repository\PlayerRepository;
8
9
class GetPositions extends AbstractController
10
{
11
    private PlayerRepository $playerRepository;
12
13
    public function __construct(PlayerRepository $playerRepository)
14
    {
15
        $this->playerRepository = $playerRepository;
16
    }
17
18
    /**
19
     * @param Request $request
20
     * @return array
21
     */
22
    public function __invoke(Request $request): array
23
    {
24
        $idPlayer = $request->query->get('idPlayer', null);
25
        $object = $this->playerRepository->findOneBy(array('id' => $idPlayer), array('date' => 'DESC'));
26
        return array(
27
            $object->getChartRank1(),
28
            $object->getChartRank2(),
29
            $object->getChartRank3(),
30
            $object->getChartRank(4),
31
            $object->getChartRank(5),
32
            $object->getChartRank(6),
33
            $object->getChartRank(7),
34
            $object->getChartRank(8),
35
            $object->getChartRank(9),
36
            $object->getChartRank(10),
37
            $object->getChartRank(11),
38
            $object->getChartRank(12),
39
            $object->getChartRank(13),
40
            $object->getChartRank(14),
41
            $object->getChartRank(15),
42
            $object->getChartRank(16),
43
            $object->getChartRank(17),
44
            $object->getChartRank(18),
45
            $object->getChartRank(19),
46
            $object->getChartRank(20),
47
            $object->getChartRank(21),
48
            $object->getChartRank(22),
49
            $object->getChartRank(23),
50
            $object->getChartRank(24),
51
            $object->getChartRank(25),
52
            $object->getChartRank(26),
53
            $object->getChartRank(27),
54
            $object->getChartRank(28),
55
            $object->getChartRank(29),
56
            $object->getChartRank(30),
57
        );
58
    }
59
}
60