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 ( 1b5d38...dbd3cc )
by Brett
04:11
created

src/panels/DbPanel.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace bedezign\yii2\audit\panels;
4
5
use bedezign\yii2\audit\components\panels\DataStoragePanelTrait;
6
use Yii;
7
use yii\debug\models\search\Db;
8
use yii\grid\GridViewAsset;
9
10
/**
11
 * DbPanel
12
 * @package bedezign\yii2\audit\panels
13
 *
14
 * @method bool hasExplain()
15
 */
16
class DbPanel extends \yii\debug\panels\DbPanel
17
{
18
    use DataStoragePanelTrait;
19
20
    /**
21
     * @var array current database request timings
22
     */
23
    private $_timings;
24
25
    /**
26
     * @inheritdoc
27
     */
28 1
    public function getLabel()
29
    {
30 1
        $timings = $this->calculateTimings();
31 1
        $queryCount = count($timings);
32 1
        $queryTime = number_format($this->getTotalQueryTime($timings) * 1000) . ' ms';
33 1
        return $this->getName() . ' <small>(' . $queryCount . ' / ' . $queryTime . ')</small>';
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39 3
    public function getDetail()
40
    {
41 1
        $searchModel = new Db();
42 1
43
        if (!$searchModel->load(Yii::$app->request->getQueryParams())) {
44 1
            $searchModel->load($this->defaultFilter, '');
45 1
        }
46 1
47 1
        $dataProvider = $searchModel->search($this->getModels());
0 ignored issues
show
The call to search() misses a required argument $models.

This check looks for function calls that miss required arguments.

Loading history...
48 1
        $dataProvider->getSort()->defaultOrder = $this->defaultOrder;
49 1
50 2
        return Yii::$app->view->render('@yii/debug/views/default/panels/db/detail', [
51
            'panel' => $this,
52 18
            'dataProvider' => $dataProvider,
53
            'searchModel' => $searchModel,
54 18
            'hasExplain' => method_exists($this, 'hasExplain') ? $this->hasExplain() : null,
55 18
        ]);
56
    }
57
58
    public function save()
59
    {
60
        $data = parent::save();
61 1
        return (isset($data['messages']) && count($data['messages']) > 0) ? $data : null;
62 1
    }
63 1
64 1
    /**
65
     * @inheritdoc
66
     */
67
    public function registerAssets($view)
68
    {
69
        GridViewAsset::register($view);
70
    }
71 1
72
    /**
73 1
     * Calculates given request profile timings.
74 1
     *
75 1
     * @return array timings [token, category, timestamp, traces, nesting level, elapsed time]
76 1
     */
77 1
    public function calculateTimings()
78 1
    {
79 1
        if ($this->_timings === null) {
80
            $this->_timings = [];
81
            if (isset($this->data['messages'])) {
82
                $this->_timings = Yii::getLogger()->calculateTimings($this->data['messages']);
83
            }
84
        }
85
        return $this->_timings;
86
    }
87
}