GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 8dbb7d...452128 )
by Brett
04:19
created

RequestPanel   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 72
ccs 16
cts 32
cp 0.5
rs 10
c 1
b 0
f 0
wmc 15
lcom 1
cbo 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getDetail() 0 4 1
A getRoute() 0 7 2
A save() 0 7 2
B saveCliRequest() 0 19 7
A getAction() 0 10 3
1
<?php
2
3
namespace bedezign\yii2\audit\panels;
4
5
use bedezign\yii2\audit\components\panels\DataStoragePanelTrait;
6
use Yii;
7
use yii\base\InlineAction;
8
9
/**
10
 * RequestPanel
11
 * @package bedezign\yii2\audit\panels
12
 */
13
class RequestPanel extends \yii\debug\panels\RequestPanel
14
{
15
    use DataStoragePanelTrait;
16
17
    /**
18
     * @inheritdoc
19
     */
20 1
    public function getDetail()
21
    {
22 1
        return \Yii::$app->view->render('@yii/debug/views/default/panels/request/detail', ['panel' => $this]);
23
    }
24
25
    /**
26
     * @inheritdoc
27
     */
28 18
    public function save()
29
    {
30 18
        if (Yii::$app->request instanceof \yii\console\Request) {
31
            return $this->saveCliRequest();
32
        }
33 18
        return parent::save();
34
    }
35
36
    /**
37
     * @return array
38
     */
39 18
    protected function saveCliRequest()
40
    {
41
        return [
42
            'flashes'         => $this->getFlashes(),
43
            'statusCode'      => 0,
44
            'requestHeaders'  => [],
45
            'responseHeaders' => [],
46
            'route'           => $this->getRoute(),
47
            'action'          => $this->getAction(),
48
            'actionParams'    => Yii::$app->request->params,
49
            'requestBody'     => [],
50
            'SERVER'          => empty($_SERVER) ? [] : $_SERVER,
51
            'GET'             => empty($_GET) ? [] : $_GET,
52
            'POST'            => empty($_POST) ? [] : $_POST,
53 18
            'COOKIE'          => empty($_COOKIE) ? [] : $_COOKIE,
54
            'FILES'           => empty($_FILES) ? [] : $_FILES,
55
            'SESSION'         => empty($_SESSION) ? [] : $_SESSION,
56
        ];
57
    }
58
59
    /**
60
     * @return null|string
61
     */
62 6
    protected function getAction()
63
    {
64 6
        if (Yii::$app->requestedAction) {
65 6
            if (Yii::$app->requestedAction instanceof InlineAction) {
66 1
                return get_class(Yii::$app->requestedAction->controller) . '::' . Yii::$app->requestedAction->actionMethod . '()';
67
            }
68 1
            return get_class(Yii::$app->requestedAction) . '::run()';
69
        }
70
        return null;
71
    }
72
73
    /**
74
     * @return string
75
     */
76 6
    protected function getRoute()
77
    {
78 6
        if (Yii::$app->requestedAction) {
79 1
            return \yii\helpers\Inflector::camel2id(Yii::$app->requestedAction->getUniqueId());
80
        }
81 3
        return Yii::$app->requestedRoute;
82
    }
83
84
}