Completed
Push — master ( 23c702...854a8a )
by Andrii
06:07
created

HipanelController::actions()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 44
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 31
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 44
ccs 0
cts 43
cp 0
crap 2
rs 8.8571
1
<?php
2
3
/*
4
 * HiPanel core package
5
 *
6
 * @link      https://hipanel.com/
7
 * @package   hipanel-core
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2014-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hipanel\controllers;
13
14
use hipanel\actions\ProxyAction;
15
use hipanel\actions\RedirectAction;
16
use hipanel\actions\RenderAction;
17
use Yii;
18
19
/**
20
 * HiPanel controller.
21
 * Just redirects to dashboard.
22
 */
23
class HipanelController extends \hipanel\base\Controller
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28 View Code Duplication
    public function behaviors()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30
        return [
31
            'access' => [
32
                'class' => 'yii\filters\AccessControl',
33
                'only'  => ['index'],
34
                'rules' => [
35
                    [
36
                        'actions' => ['index'],
37
                        'allow'   => true,
38
                        'roles'   => ['@'],
39
                    ],
40
                ],
41
            ],
42
        ];
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function actions()
49
    {
50
        return [
51
            'index' => [
52
                'class' => RedirectAction::class,
53
                'url'   => ['/dashboard/dashboard'],
54
            ],
55
/// later just for testing
56
            'switch'   => [
57
                'class'      => RenderAction::class,
58
                'addFlash'   => true,
59
                'success'    => Yii::t('app', 'DB truncate task has been created successfully'),
60
                'error'      => Yii::t('app', 'Error while truncating DB'),
61
                'POST html'  => [
62
                    'class'  => ProxyAction::class,
63
                    'action' => 'index',
64
                ],
65
                'GET'        => [
66
                    'class' => RenderAction::class,
67
                    'view'  => 'index',
68
                ],
69
                'POST pjax'  => [
70
                    'class'   => RenderAction::class,
71
                    'view'    => 'index',
72
                ],
73
                'default'    => [
74
                    'class' => RedirectAction::class,
75
                    'url'   => ['index'],
76
                ],
77
            ],
78
            'proxy'    => [
79
                'class'  => ProxyAction::class,
80
                'action' => 'index',
81
            ],
82
            'render'   => [
83
                'class' => RenderAction::class,
84
                'view'  => 'index',
85
            ],
86
            'redirect' => [
87
                'class' => RedirectAction::class,
88
                'url'   => ['index'],
89
            ],
90
        ];
91
    }
92
}
93