Passed
Push — master ( 8a455a...42a228 )
by Craig
07:01
created

AjaxInstallController::createMainMenuBlock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 22
nc 1
nop 0
dl 0
loc 31
rs 9.568
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula Foundation - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\Bundle\CoreInstallerBundle\Controller;
15
16
use Symfony\Component\DependencyInjection\ContainerInterface;
17
use Symfony\Component\HttpFoundation\JsonResponse;
18
use Symfony\Component\HttpFoundation\Request;
19
use Zikula\Bundle\CoreInstallerBundle\Helper\StageHelper;
20
21
/**
22
 * Class AjaxInstallController
23
 */
24
class AjaxInstallController extends AbstractController
25
{
26
    /**
27
     * @var StageHelper
28
     */
29
    private $stageHelper;
30
31
    public function __construct(ContainerInterface $container)
32
    {
33
        parent::__construct($container);
34
        $this->stageHelper = $container->get(StageHelper::class);
35
    }
36
37
    public function ajaxAction(Request $request): JsonResponse
38
    {
39
        $stage = $request->request->get('stage');
40
        $status = $this->stageHelper->executeStage($stage);
41
42
        return new JsonResponse(['status' => $status]);
43
    }
44
}
45