Passed
Push — master ( 57f692...abb7a8 )
by Mihail
04:20
created

Main::actionSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Apps\Controller\Install;
4
5
6
use Apps\Model\Install\Main\EntityCheck;
7
use Apps\Model\Install\Main\FormInstall;
8
use Ffcms\Core\App;
9
use Ffcms\Core\Arch\Controller;
10
use Ffcms\Core\Exception\ForbiddenException;
11
use Ffcms\Core\Helper\FileSystem\File;
12
13
class Main extends Controller
14
{
15
16
    public function actionIndex()
17
    {
18
        if (File::exist('/Private/Install/install.lock')) {
19
            throw new ForbiddenException('Installer is blocked! If you want to continue delete file /Private/Installer/install.lock');
20
        }
21
22
        $model = new EntityCheck();
23
24
        $this->response = App::$View->render('index', [
25
            'model' => $model
26
        ]);
27
    }
28
29
    public function actionInstall()
30
    {
31
        if (File::exist('/Private/Install/install.lock')) {
32
            throw new ForbiddenException('Installer is blocked! If you want to continue delete file /Private/Installer/install.lock');
33
        }
34
35
        $model = new FormInstall();
36
        if ($model->send() && $model->validate()) {
37
            $model->make();
38
            App::$Response->redirect('main/success');
39
        }
40
41
        $this->response = App::$View->render('install', [
42
            'model' => $model->export()
43
        ]);
44
    }
45
46
    public function actionSuccess()
47
    {
48
        $this->response = App::$View->render('success');
49
    }
50
}