Commit 68281d55 by Tobias Munk

fixed code-style

parent dc110a9c
......@@ -6,6 +6,7 @@
*/
namespace yii\debug;
use yii\web\AssetBundle;
/**
......
......@@ -154,5 +154,4 @@ class LogTarget extends Target
# / 2 because messages are in couple (begin/end)
return count($profileLogs['messages']) / 2;
}
}
......@@ -72,7 +72,7 @@ class Module extends \yii\base\Module
$this->dataPath = Yii::getAlias($this->dataPath);
$this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this);
// do not initialize view component before application is ready (needed when debug in preload)
Yii::$app->on(Application::EVENT_BEFORE_REQUEST, function() {
Yii::$app->on(Application::EVENT_BEFORE_REQUEST, function () {
Yii::$app->getView()->on(View::EVENT_END_BODY, [$this, 'renderToolbar']);
});
......
......@@ -39,7 +39,7 @@ class DefaultController extends Controller
public function actions()
{
$actions = [];
foreach($this->module->panels as $panel) {
foreach ($this->module->panels as $panel) {
$actions = array_merge($actions, $panel->actions);
}
return $actions;
......
......@@ -56,21 +56,22 @@ class ConfigPanel extends Panel
return $data;
}
/**
* Returns the BODY contents of the phpinfo() output
*
* @return array
*/
public function getPhpInfo(){
ob_start();
phpinfo();
$pinfo = ob_get_contents();
ob_end_clean();
$phpinfo = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1',$pinfo);
$phpinfo = str_replace('<table ','<table class="table table-condensed table-bordered table-striped table-hover"',$phpinfo);
/**
* Returns the BODY contents of the phpinfo() output
*
* @return array
*/
public function getPhpInfo ()
{
ob_start();
phpinfo();
$pinfo = ob_get_contents();
ob_end_clean();
$phpinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo);
$phpinfo = str_replace('<table ', '<table class="table table-condensed table-bordered table-striped table-hover"', $phpinfo);
return $phpinfo;
}
return $phpinfo;
}
/**
* @inheritdoc
......
......@@ -54,7 +54,7 @@ class DbPanel extends Panel
$queryTime = number_format($this->getTotalQueryTime($timings) * 1000) . ' ms';
return Yii::$app->view->render('panels/db/summary', [
'timings' => $this->calculateTimings(),
'timings' => $this->calculateTimings(),
'panel' => $this,
'queryCount' => $queryCount,
'queryTime' => $queryTime,
......@@ -127,7 +127,7 @@ class DbPanel extends Panel
$this->_models = [];
$timings = $this->calculateTimings();
foreach($timings as $seq => $dbTiming) {
foreach ($timings as $seq => $dbTiming) {
$this->_models[] = [
'type' => $this->getQueryType($dbTiming['info']),
'query' => $dbTiming['info'],
......@@ -164,5 +164,4 @@ class DbPanel extends Panel
{
return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold));
}
}
......@@ -50,7 +50,7 @@ class LogPanel extends Panel
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this->getModels());
return Yii::$app->view->render('panels/log/detail', [
'dataProvider' => $dataProvider,
'dataProvider' => $dataProvider,
'panel' => $this,
'searchModel' => $searchModel,
]);
......@@ -78,7 +78,7 @@ class LogPanel extends Panel
if ($this->_models === null || $refresh) {
$this->_models = [];
foreach($this->data['messages'] as $message) {
foreach ($this->data['messages'] as $message) {
$this->_models[] = [
'message' => $message[0],
'level' => $message[1],
......
......@@ -86,7 +86,7 @@ class ProfilingPanel extends Panel
$this->_models = [];
$timings = Yii::$app->getLog()->calculateTimings($this->data['messages']);
foreach($timings as $seq => $profileTiming) {
foreach ($timings as $seq => $profileTiming) {
$this->_models[] = [
'duration' => $profileTiming['duration'] * 1000, // in milliseconds
'category' => $profileTiming['category'],
......
......@@ -53,17 +53,15 @@ echo GridView::widget([
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'tag',
'value' => function ($data)
{
'value' => function ($data) {
return Html::a($data['tag'], ['view', 'tag' => $data['tag']]);
},
'format' => 'html',
],
[
'attribute' => 'time',
'value' => function ($data) use ($timeFormatter)
{
return $timeFormatter->asDateTime($data['time'], 'H:i_j.M');
'value' => function ($data) use ($timeFormatter) {
return $timeFormatter->asDateTime($data['time'], 'short');
},
],
'ip',
......@@ -75,7 +73,7 @@ echo GridView::widget([
if ($dbPanel->isQueryCountCritical($data['sqlCount'])) {
$content = Html::tag('b', $data['sqlCount']) . ' ' . Html::tag('span','',['class' => 'glyphicon glyphicon-exclamation-sign']);
$content = Html::tag('b', $data['sqlCount']) . ' ' . Html::tag('span', '', ['class' => 'glyphicon glyphicon-exclamation-sign']);
return Html::a($content, ['view', 'panel' => 'db', 'tag' => $data['tag']], [
'title' => 'Too many queries. Allowed count is ' . $dbPanel->criticalQueryThreshold,
]);
......@@ -92,8 +90,7 @@ echo GridView::widget([
],
[
'attribute'=>'ajax',
'value' => function ($data)
{
'value' => function ($data) {
return $data['ajax'] ? 'Yes' : 'No';
},
'filter' => ['No', 'Yes'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment