Completed
Push — master ( f04bdf...03085f )
by Andrii
05:00
created

ConfigController::actions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 38
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 27
dl 0
loc 38
ccs 0
cts 32
cp 0
rs 9.488
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace hipanel\modules\server\controllers;
4
5
use hipanel\actions\IndexAction;
6
use hipanel\actions\SmartCreateAction;
7
use hipanel\actions\SmartDeleteAction;
8
use hipanel\actions\SmartUpdateAction;
9
use hipanel\actions\ValidateFormAction;
10
use hipanel\actions\ViewAction;
11
use hipanel\base\CrudController;
12
use hipanel\modules\server\forms\ConfigForm;
13
use hiqdev\hiart\Collection;
14
use Yii;
15
16
class ConfigController extends CrudController
17
{
18
    public function actions()
19
    {
20
        return array_merge(parent::actions(), [
21
            'index' => [
22
                'class' => IndexAction::class,
23
            ],
24
            'view' => [
25
                'class' => ViewAction::class,
26
            ],
27
            'create' => [
28
                'class' => SmartCreateAction::class,
29
                'scenario' => 'create',
30
                'success' => Yii::t(
31
                    'hipanel:server:config',
32
                    'The configuration was successfully created'
33
                ),
34
            ],
35
            'update' => [
36
                'class' => SmartUpdateAction::class,
37
                'scenario' => 'update',
38
                'success' => Yii::t(
39
                    'hipanel:server:config',
40
                    'The configuration was successfully updated'
41
                ),
42
            ],
43
            'delete' => [
44
                'class' => SmartDeleteAction::class,
45
                'success' => Yii::t(
46
                    'hipanel:server:config',
47
                    'The configuration has been deleted'
48
                ),
49
                'error' => Yii::t(
50
                    'hipanel:server:config',
51
                    'Failed to delete the configuration'
52
                ),
53
            ],
54
            'validate-form' => [
55
                'class' => ValidateFormAction::class,
56
            ],
57
        ]);
58
    }
59
}
60