Module::isPanel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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