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

AjaxInstallController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 19
rs 10
c 2
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ajaxAction() 0 6 1
A __construct() 0 4 1
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