Commit 68281d55 by Tobias Munk

fixed code-style

parent dc110a9c
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
namespace yii\debug; namespace yii\debug;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**
......
...@@ -154,5 +154,4 @@ class LogTarget extends Target ...@@ -154,5 +154,4 @@ class LogTarget extends Target
# / 2 because messages are in couple (begin/end) # / 2 because messages are in couple (begin/end)
return count($profileLogs['messages']) / 2; return count($profileLogs['messages']) / 2;
} }
} }
...@@ -72,7 +72,7 @@ class Module extends \yii\base\Module ...@@ -72,7 +72,7 @@ class Module extends \yii\base\Module
$this->dataPath = Yii::getAlias($this->dataPath); $this->dataPath = Yii::getAlias($this->dataPath);
$this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this); $this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this);
// do not initialize view component before application is ready (needed when debug in preload) // 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']); Yii::$app->getView()->on(View::EVENT_END_BODY, [$this, 'renderToolbar']);
}); });
......
...@@ -39,7 +39,7 @@ class DefaultController extends Controller ...@@ -39,7 +39,7 @@ class DefaultController extends Controller
public function actions() public function actions()
{ {
$actions = []; $actions = [];
foreach($this->module->panels as $panel) { foreach ($this->module->panels as $panel) {
$actions = array_merge($actions, $panel->actions); $actions = array_merge($actions, $panel->actions);
} }
return $actions; return $actions;
......
...@@ -61,13 +61,14 @@ class ConfigPanel extends Panel ...@@ -61,13 +61,14 @@ class ConfigPanel extends Panel
* *
* @return array * @return array
*/ */
public function getPhpInfo(){ public function getPhpInfo ()
{
ob_start(); ob_start();
phpinfo(); phpinfo();
$pinfo = ob_get_contents(); $pinfo = ob_get_contents();
ob_end_clean(); ob_end_clean();
$phpinfo = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1',$pinfo); $phpinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo);
$phpinfo = str_replace('<table ','<table class="table table-condensed table-bordered table-striped table-hover"',$phpinfo); $phpinfo = str_replace('<table ', '<table class="table table-condensed table-bordered table-striped table-hover"', $phpinfo);
return $phpinfo; return $phpinfo;
} }
......
...@@ -127,7 +127,7 @@ class DbPanel extends Panel ...@@ -127,7 +127,7 @@ class DbPanel extends Panel
$this->_models = []; $this->_models = [];
$timings = $this->calculateTimings(); $timings = $this->calculateTimings();
foreach($timings as $seq => $dbTiming) { foreach ($timings as $seq => $dbTiming) {
$this->_models[] = [ $this->_models[] = [
'type' => $this->getQueryType($dbTiming['info']), 'type' => $this->getQueryType($dbTiming['info']),
'query' => $dbTiming['info'], 'query' => $dbTiming['info'],
...@@ -164,5 +164,4 @@ class DbPanel extends Panel ...@@ -164,5 +164,4 @@ class DbPanel extends Panel
{ {
return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold)); return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold));
} }
} }
...@@ -78,7 +78,7 @@ class LogPanel extends Panel ...@@ -78,7 +78,7 @@ class LogPanel extends Panel
if ($this->_models === null || $refresh) { if ($this->_models === null || $refresh) {
$this->_models = []; $this->_models = [];
foreach($this->data['messages'] as $message) { foreach ($this->data['messages'] as $message) {
$this->_models[] = [ $this->_models[] = [
'message' => $message[0], 'message' => $message[0],
'level' => $message[1], 'level' => $message[1],
......
...@@ -86,7 +86,7 @@ class ProfilingPanel extends Panel ...@@ -86,7 +86,7 @@ class ProfilingPanel extends Panel
$this->_models = []; $this->_models = [];
$timings = Yii::$app->getLog()->calculateTimings($this->data['messages']); $timings = Yii::$app->getLog()->calculateTimings($this->data['messages']);
foreach($timings as $seq => $profileTiming) { foreach ($timings as $seq => $profileTiming) {
$this->_models[] = [ $this->_models[] = [
'duration' => $profileTiming['duration'] * 1000, // in milliseconds 'duration' => $profileTiming['duration'] * 1000, // in milliseconds
'category' => $profileTiming['category'], 'category' => $profileTiming['category'],
......
...@@ -53,17 +53,15 @@ echo GridView::widget([ ...@@ -53,17 +53,15 @@ echo GridView::widget([
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
[ [
'attribute' => 'tag', 'attribute' => 'tag',
'value' => function ($data) 'value' => function ($data) {
{
return Html::a($data['tag'], ['view', 'tag' => $data['tag']]); return Html::a($data['tag'], ['view', 'tag' => $data['tag']]);
}, },
'format' => 'html', 'format' => 'html',
], ],
[ [
'attribute' => 'time', 'attribute' => 'time',
'value' => function ($data) use ($timeFormatter) 'value' => function ($data) use ($timeFormatter) {
{ return $timeFormatter->asDateTime($data['time'], 'short');
return $timeFormatter->asDateTime($data['time'], 'H:i_j.M');
}, },
], ],
'ip', 'ip',
...@@ -75,7 +73,7 @@ echo GridView::widget([ ...@@ -75,7 +73,7 @@ echo GridView::widget([
if ($dbPanel->isQueryCountCritical($data['sqlCount'])) { 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']], [ return Html::a($content, ['view', 'panel' => 'db', 'tag' => $data['tag']], [
'title' => 'Too many queries. Allowed count is ' . $dbPanel->criticalQueryThreshold, 'title' => 'Too many queries. Allowed count is ' . $dbPanel->criticalQueryThreshold,
]); ]);
...@@ -92,8 +90,7 @@ echo GridView::widget([ ...@@ -92,8 +90,7 @@ echo GridView::widget([
], ],
[ [
'attribute'=>'ajax', 'attribute'=>'ajax',
'value' => function ($data) 'value' => function ($data) {
{
return $data['ajax'] ? 'Yes' : 'No'; return $data['ajax'] ? 'Yes' : 'No';
}, },
'filter' => ['No', 'Yes'], '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