Browse Source

Merge pull request #1751 from lucianobaraglia/some-debug-fixes

Some debug code style fixes...
tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
ed11750c06
  1. 4
      extensions/yii/debug/controllers/DefaultController.php
  2. 8
      extensions/yii/debug/panels/DbPanel.php
  3. 8
      extensions/yii/debug/panels/LogPanel.php
  4. 4
      extensions/yii/debug/panels/ProfilingPanel.php
  5. 18
      extensions/yii/debug/views/default/panels/request/detail.php
  6. 2
      extensions/yii/debug/views/default/view.php

4
extensions/yii/debug/controllers/DefaultController.php

@ -20,7 +20,7 @@ class DefaultController extends Controller
{
public $layout = 'main';
/**
* @var \yii\debug\Module
* @var \yii\debug\Module
*/
public $module;
/**
@ -88,7 +88,7 @@ class DefaultController extends Controller
protected function getManifest($forceReload = false)
{
if ($this->_manifest === null || $forceReload) {
if ($forceReload) {
if ($forceReload) {
clearstatcache();
}
$indexFile = $this->module->dataPath . '/index.data';

8
extensions/yii/debug/panels/DbPanel.php

@ -42,7 +42,7 @@ class DbPanel extends Panel
$queryCount = count($timings);
$queryTime = number_format($this->getTotalQueryTime($timings) * 1000) . ' ms';
return Yii::$app->view->render('panels/db/summary',[
return Yii::$app->view->render('panels/db/summary', [
'timings' => $this->calculateTimings(),
'panel' => $this,
'queryCount' => $queryCount,
@ -55,7 +55,7 @@ class DbPanel extends Panel
$searchModel = new Db();
$dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels());
return Yii::$app->view->render('panels/db/detail', [
return Yii::$app->view->render('panels/db/detail', [
'panel' => $this,
'dataProvider' => $dataProvider,
'searchModel' => $searchModel,
@ -112,9 +112,9 @@ class DbPanel extends Panel
$this->_models[] = [
'type' => $this->detectQueryType($dbTiming['info']),
'query' => $dbTiming['info'],
'duration' => ($dbTiming['duration'] * 1000), #in milliseconds
'duration' => ($dbTiming['duration'] * 1000), // in milliseconds
'trace' => $dbTiming['trace'],
'timestamp' => $dbTiming['timestamp'],
'timestamp' => ($dbTiming['timestamp'] * 1000), // in milliseconds
'seq' => $seq,
];
}

8
extensions/yii/debug/panels/LogPanel.php

@ -33,7 +33,7 @@ class LogPanel extends Panel
public function getSummary()
{
return Yii::$app->view->render('panels/log/summary', ['data' => $this->data, 'panel' => $this]);
return Yii::$app->view->render('panels/log/summary', ['data' => $this->data, 'panel' => $this]);
}
public function getDetail()
@ -41,7 +41,7 @@ class LogPanel extends Panel
$searchModel = new Log();
$dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels());
return Yii::$app->view->render('panels/log/detail',[
return Yii::$app->view->render('panels/log/detail', [
'dataProvider' => $dataProvider,
'panel' => $this,
'searchModel' => $searchModel,
@ -61,7 +61,7 @@ class LogPanel extends Panel
* @param boolean $refresh if needed to build models from log messages and refresh them.
* @return array models
*/
protected function getModels($refresh=false)
protected function getModels($refresh = false)
{
if ($this->_models === null || $refresh) {
$this->_models = [];
@ -71,7 +71,7 @@ class LogPanel extends Panel
'message' => $message[0],
'level' => $message[1],
'category' => $message[2],
'time' => ($message[3] * 1000), #time in milliseconds
'time' => ($message[3] * 1000), // time in milliseconds
'trace' => $message[4]
];
}

4
extensions/yii/debug/panels/ProfilingPanel.php

@ -32,7 +32,7 @@ class ProfilingPanel extends Panel
public function getSummary()
{
return Yii::$app->view->render('panels/profile/summary', [
return Yii::$app->view->render('panels/profile/summary', [
'memory' => sprintf('%.1f MB', $this->data['memory'] / 1048576),
'time' => number_format($this->data['time'] * 1000) . ' ms',
'panel' => $this
@ -44,7 +44,7 @@ class ProfilingPanel extends Panel
$searchModel = new Profile();
$dataProvider = $searchModel->search(Yii::$app->request->get(), $this->getModels());
return Yii::$app->view->render('panels/profile/detail', [
return Yii::$app->view->render('panels/profile/detail', [
'panel' => $this,
'dataProvider' => $dataProvider,
'searchModel' => $searchModel,

18
extensions/yii/debug/views/default/panels/request/detail.php

@ -9,22 +9,22 @@ echo Tabs::widget([
'items' => [
[
'label' => 'Parameters',
'content' => $this->render('panels/request/table', ['caption' => 'Routing', 'values' => ['Route' => $panel->data['route'], 'Action' => $panel->data['action'], 'Parameters' => $panel->data['actionParams']]])
. $this->render('panels/request/table', ['caption' => '$_GET', 'values' => $panel->data['GET']])
. $this->render('panels/request/table', ['caption' => '$_POST', 'values' => $panel->data['POST']])
. $this->render('panels/request/table', ['caption' => '$_FILES', 'values' => $panel->data['FILES']])
. $this->render('panels/request/table', ['caption' => '$_COOKIE', 'values' => $panel->data['COOKIE']]),
'content' => $this->render('panels/request/table', ['caption' => 'Routing', 'values' => ['Route' => $panel->data['route'], 'Action' => $panel->data['action'], 'Parameters' => $panel->data['actionParams']]])
. $this->render('panels/request/table', ['caption' => '$_GET', 'values' => $panel->data['GET']])
. $this->render('panels/request/table', ['caption' => '$_POST', 'values' => $panel->data['POST']])
. $this->render('panels/request/table', ['caption' => '$_FILES', 'values' => $panel->data['FILES']])
. $this->render('panels/request/table', ['caption' => '$_COOKIE', 'values' => $panel->data['COOKIE']]),
'active' => true,
],
[
'label' => 'Headers',
'content' => $this->render('panels/request/table', ['caption' => 'Request Headers', 'values' => $panel->data['requestHeaders']])
. $this->render('panels/request/table', ['caption' => 'Response Headers', 'values' => $panel->data['responseHeaders']])
'content' => $this->render('panels/request/table', ['caption' => 'Request Headers', 'values' => $panel->data['requestHeaders']])
. $this->render('panels/request/table', ['caption' => 'Response Headers', 'values' => $panel->data['responseHeaders']])
],
[
'label' => 'Session',
'content' => $this->render('panels/request/table', ['caption' => '$_SESSION', 'values' => $panel->data['SESSION']])
. $this->render('panels/request/table', ['caption' => 'Flashes', 'values' => $panel->data['flashes']])
'content' => $this->render('panels/request/table', ['caption' => '$_SESSION', 'values' => $panel->data['SESSION']])
. $this->render('panels/request/table', ['caption' => 'Flashes', 'values' => $panel->data['flashes']])
],
[
'label' => '$_SERVER',

2
extensions/yii/debug/views/default/view.php

@ -18,7 +18,7 @@ $this->title = 'Yii Debugger';
<div class="default-view">
<div id="yii-debug-toolbar">
<div class="yii-debug-toolbar-block title">
<?php echo Html::a('Yii Debugger', ['index'],['title' => 'Back to main debug page']);?>
<?= Html::a('Yii Debugger', ['index'], ['title' => 'Back to main debug page']) ?>
</div>
<?php foreach ($panels as $panel): ?>
<?= $panel->getSummary() ?>

Loading…
Cancel
Save