Completed
Push — master ( 635f13...3b2a71 )
by Axel
37:58 queued 21:55
created

InstallerController::installAction()   A

Complexity

Conditions 5
Paths 4

Size

Total Lines 15
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 6
nc 4
nop 2
dl 0
loc 15
rs 9.6111
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\Request;
18
use Symfony\Component\HttpFoundation\Response;
19
20
/**
21
 * Class InstallerController
22
 */
23
class InstallerController extends AbstractController
24
{
25
    public function __construct(ContainerInterface $container)
26
    {
27
        parent::__construct($container);
28
        $this->router = $container->get('router');
29
        $this->form = $this->container->get('form.factory');
30
    }
31
32
    public function installAction(Request $request, string $stage): Response
33
    {
34
        // already installed?
35
        if ('complete' !== $stage && true === $this->container->getParameter('installed')) {
36
            $stage = 'installed';
37
        }
38
39
        // not installed but requesting installed stage?
40
        if ('installed' === $stage && false === $this->container->getParameter('installed')) {
41
            $stage = 'notinstalled';
42
        }
43
44
        $request->setLocale($this->container->getParameter('locale'));
45
46
        return $this->controllerHelper->processWizard($request, $stage, 'install');
47
    }
48
}
49