Completed
Push — master ( 7ee304...69455d )
by Andrii
05:06
created

Module::isPanel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Domain plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-domain
6
 * @package   hipanel-module-domain
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel;
12
13
use Yii;
14
use yii\helpers\Url;
15
16
/**
17
 * HiPanel Core Module.
18
 */
19
class Module extends \hipanel\base\Module
20
{
21
    public $notPanel;
22
23
    public $panelUrl;
24
25
    public function isPanel()
26
    {
27
        return !$this->notPanel;
28
    }
29
30
    public function redirectPanel()
31
    {
32
        $request = Yii::$app->request;
33
        $path = $request->getPathInfo();
34
        $vars = $request->get();
35
36
        $url = $this->panelUrl . '/' . $path . '?' . http_build_query($vars);
37
38
        Yii::$app->response->redirect($url);
39
        Yii::$app->end();
40
    }
41
}
42