GetPositions   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 35
dl 0
loc 47
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 34 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VideoGamesRecords\DwhBundle\Controller\Player;
6
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use VideoGamesRecords\CoreBundle\Entity\Player;
9
use VideoGamesRecords\DwhBundle\Repository\PlayerRepository;
10
11
class GetPositions extends AbstractController
12
{
13
    private PlayerRepository $playerRepository;
14
15
    public function __construct(PlayerRepository $playerRepository)
16
    {
17
        $this->playerRepository = $playerRepository;
18
    }
19
20
    /**
21
     * @param Player $player
22
     * @return array
23
     */
24
    public function __invoke(Player $player): array
25
    {
26
        $object = $this->playerRepository->findOneBy(array('id' => $player->getId()), array('date' => 'DESC'));
27
        return array(
28
            $object->getChartRank1(),
29
            $object->getChartRank2(),
30
            $object->getChartRank3(),
31
            $object->getChartRank(4),
32
            $object->getChartRank(5),
33
            $object->getChartRank(6),
34
            $object->getChartRank(7),
35
            $object->getChartRank(8),
36
            $object->getChartRank(9),
37
            $object->getChartRank(10),
38
            $object->getChartRank(11),
39
            $object->getChartRank(12),
40
            $object->getChartRank(13),
41
            $object->getChartRank(14),
42
            $object->getChartRank(15),
43
            $object->getChartRank(16),
44
            $object->getChartRank(17),
45
            $object->getChartRank(18),
46
            $object->getChartRank(19),
47
            $object->getChartRank(20),
48
            $object->getChartRank(21),
49
            $object->getChartRank(22),
50
            $object->getChartRank(23),
51
            $object->getChartRank(24),
52
            $object->getChartRank(25),
53
            $object->getChartRank(26),
54
            $object->getChartRank(27),
55
            $object->getChartRank(28),
56
            $object->getChartRank(29),
57
            $object->getChartRank(30),
58
        );
59
    }
60
}
61