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::save()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 7
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 9.4285
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
}