Passed
Branch develop (e4e9af)
by BENARD
05:38
created

PlayerController::stats()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 12
c 0
b 0
f 0
rs 9.9666
cc 1
nc 1
nop 0
1
<?php
2
3
namespace VideoGamesRecords\CoreBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6
use Symfony\Component\HttpFoundation\Request;
7
use VideoGamesRecords\CoreBundle\Entity\Player;
8
use VideoGamesRecords\CoreBundle\Repository\PlayerRepository;
9
10
/**
11
 * Class PlayerController
12
 */
13
class PlayerController extends AbstractController
14
{
15
    private PlayerRepository $playerRepository;
16
17
    public function __construct(PlayerRepository $playerRepository)
18
    {
19
        $this->playerRepository = $playerRepository;
20
    }
21
22
    /**
23
     * @param Request $request
24
     * @return mixed
25
     */
26
    public function autocomplete(Request $request): mixed
27
    {
28
        $q = $request->query->get('query', null);
29
        return $this->playerRepository->autocomplete($q);
30
    }
31
32
    /**
33
     * @param Player    $player
34
     * @return mixed
35
     */
36
    public function playerChartStatus(Player $player)
37
    {
38
        return $this->getDoctrine()->getRepository('VideoGamesRecords\CoreBundle\Entity\PlayerChartStatus')
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Bundle\Framework...ntroller::getDoctrine() has been deprecated: since Symfony 5.4, inject an instance of ManagerRegistry in your controller instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

38
        return /** @scrutinizer ignore-deprecated */ $this->getDoctrine()->getRepository('VideoGamesRecords\CoreBundle\Entity\PlayerChartStatus')

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
39
            ->getStatsFromPlayer($player);
40
    }
41
}
42