Passed
Push — develop ( 9adc72...0701e3 )
by BENARD
12:13 queued 05:58
created

GameAdminController::setProofVideoOnly()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VideoGamesRecords\CoreBundle\Controller\Admin;
6
7
use Sonata\AdminBundle\Controller\CRUDController;
8
use Symfony\Component\HttpFoundation\RedirectResponse;
9
use VideoGamesRecords\CoreBundle\Manager\GameManager;
10
use Yokai\SonataWorkflow\Controller\WorkflowControllerTrait;
11
12
class GameAdminController extends CRUDController
13
{
14
    use WorkflowControllerTrait;
15
16
    private GameManager $gameManager;
17
18
    public function __construct(GameManager $gameManager)
19
    {
20
        $this->gameManager = $gameManager;
21
    }
22
23
    /**
24
     * @param $id
25
     * @return RedirectResponse
26
     */
27
    public function copyAction($id): RedirectResponse
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

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

27
    public function copyAction(/** @scrutinizer ignore-unused */ $id): RedirectResponse

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
    {
29
        if ($this->admin->hasAccess('create')) {
30
            $game = $this->admin->getSubject();
31
32
            $this->gameManager->copy($game);
33
            $this->addFlash('sonata_flash_success', 'Copied successfully');
34
        }
35
36
        return new RedirectResponse($this->admin->generateUrl('list'));
37
    }
38
39
    /**
40
     * @param $id
41
     * @return RedirectResponse
42
     */
43
    public function majAction($id): RedirectResponse
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

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

43
    public function majAction(/** @scrutinizer ignore-unused */ $id): RedirectResponse

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
44
    {
45
        $this->gameManager->maj($this->admin->getSubject());
46
        $this->addFlash('sonata_flash_success', 'Game maj successfully');
47
        return new RedirectResponse($this->admin->generateUrl('list'));
48
    }
49
50
    /**
51
     * @param $id
52
     * @return RedirectResponse
53
     */
54
    public function setProofVideoOnly($id): RedirectResponse
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

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

54
    public function setProofVideoOnly(/** @scrutinizer ignore-unused */ $id): RedirectResponse

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
    {
56
        $this->gameManager->setProofVideoOnly($this->admin->getSubject());
57
        $this->addFlash('sonata_flash_success', 'Game maj successfully');
58
        return new RedirectResponse($this->admin->generateUrl('list'));
59
    }
60
}
61