Commit dc9f9d92 by Klimov Paul

Doc comments and code style for 'debug' extension adjusted

parent bd574e8b
...@@ -25,12 +25,22 @@ use yii\helpers\Url; ...@@ -25,12 +25,22 @@ use yii\helpers\Url;
*/ */
class Panel extends Component class Panel extends Component
{ {
/**
* @var string panel unique identifier.
* It is set automatically by the container module.
*/
public $id; public $id;
/**
* @var string request data set identifier.
*/
public $tag; public $tag;
/** /**
* @var Module * @var Module
*/ */
public $module; public $module;
/**
* @var mixed data associated with panel
*/
public $data; public $data;
/** /**
* @var array array of actions to add to the debug modules default controller. * @var array array of actions to add to the debug modules default controller.
......
...@@ -25,7 +25,6 @@ use yii\mail\MessageInterface; ...@@ -25,7 +25,6 @@ use yii\mail\MessageInterface;
*/ */
class MailPanel extends Panel class MailPanel extends Panel
{ {
/** /**
* @var string path where all emails will be saved. should be an alias. * @var string path where all emails will be saved. should be an alias.
*/ */
...@@ -35,6 +34,9 @@ class MailPanel extends Panel ...@@ -35,6 +34,9 @@ class MailPanel extends Panel
*/ */
private $_messages = []; private $_messages = [];
/**
* @inheritdoc
*/
public function init() public function init()
{ {
parent::init(); parent::init();
...@@ -74,16 +76,25 @@ class MailPanel extends Panel ...@@ -74,16 +76,25 @@ class MailPanel extends Panel
}); });
} }
/**
* @inheritdoc
*/
public function getName() public function getName()
{ {
return 'Mail'; return 'Mail';
} }
/**
* @inheritdoc
*/
public function getSummary() public function getSummary()
{ {
return Yii::$app->view->render('panels/mail/summary', ['panel' => $this, 'mailCount' => count($this->data)]); return Yii::$app->view->render('panels/mail/summary', ['panel' => $this, 'mailCount' => count($this->data)]);
} }
/**
* @inheritdoc
*/
public function getDetail() public function getDetail()
{ {
$searchModel = new Mail(); $searchModel = new Mail();
...@@ -96,6 +107,9 @@ class MailPanel extends Panel ...@@ -96,6 +107,9 @@ class MailPanel extends Panel
]); ]);
} }
/**
* @inheritdoc
*/
public function save() public function save()
{ {
return $this->getMessages(); return $this->getMessages();
......
<?php <?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\data\ArrayDataProvider;
/** /**
* @var \yii\web\View $this * @var \yii\web\View $this
* @var array $manifest * @var array $manifest
...@@ -12,6 +7,10 @@ use yii\data\ArrayDataProvider; ...@@ -12,6 +7,10 @@ use yii\data\ArrayDataProvider;
* @var \yii\debug\Panel[] $panels * @var \yii\debug\Panel[] $panels
*/ */
use yii\helpers\Html;
use yii\grid\GridView;
use yii\data\ArrayDataProvider;
$this->title = 'Yii Debugger'; $this->title = 'Yii Debugger';
?> ?>
<div class="default-index"> <div class="default-index">
......
...@@ -13,7 +13,7 @@ use yii\helpers\Html; ...@@ -13,7 +13,7 @@ use yii\helpers\Html;
<p>Empty.</p> <p>Empty.</p>
<?php else: ?> <?php else: ?>
<table class="table table-condensed table-bordered table-striped table-hover" style="table-layout: fixed;"> <table class="table table-condensed table-bordered table-striped table-hover" style="table-layout: fixed;">
<thead> <thead>
......
<?php <?php
/**
* @var yii\debug\panels\DbPanel $panel
* @var yii\debug\models\search\Db $searchModel
* @var yii\data\ArrayDataProvider $dataProvider
*/
use yii\helpers\Html; use yii\helpers\Html;
use yii\grid\GridView; use yii\grid\GridView;
......
<?php
/**
* @var yii\debug\panels\DbPanel $panel
* @var integer $queryCount
* @var integer $queryTime
*/
?>
<?php if ($queryCount): ?> <?php if ($queryCount): ?>
<div class="yii-debug-toolbar-block"> <div class="yii-debug-toolbar-block">
<a href="<?= $panel->getUrl() ?>" title="Executed <?= $queryCount ?> database queries which took <?= $queryTime ?>."> <a href="<?= $panel->getUrl() ?>" title="Executed <?= $queryCount ?> database queries which took <?= $queryTime ?>.">
......
<?php <?php
/**
* @var yii\debug\panels\LogPanel $panel
* @var yii\debug\models\search\Log $searchModel
* @var yii\data\ArrayDataProvider $dataProvider
*/
use yii\helpers\Html; use yii\helpers\Html;
use yii\grid\GridView; use yii\grid\GridView;
use yii\helpers\VarDumper; use yii\helpers\VarDumper;
......
<?php <?php
/**
* @var yii\debug\panels\LogPanel $panel
* @var array $data
*/
use yii\log\Target; use yii\log\Target;
use yii\log\Logger; use yii\log\Logger;
......
<?php <?php
/**
* @var array $model
*/
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\DetailView; use yii\widgets\DetailView;
...@@ -6,33 +9,33 @@ use yii\widgets\DetailView; ...@@ -6,33 +9,33 @@ use yii\widgets\DetailView;
$timeFormatter = extension_loaded('intl') ? Yii::createObject(['class' => 'yii\i18n\Formatter']) : Yii::$app->formatter; $timeFormatter = extension_loaded('intl') ? Yii::createObject(['class' => 'yii\i18n\Formatter']) : Yii::$app->formatter;
echo DetailView::widget([ echo DetailView::widget([
'model' => $model, 'model' => $model,
'attributes' => [ 'attributes' => [
'headers', 'headers',
'from', 'from',
'to', 'to',
'charset', 'charset',
[ [
'attribute' => 'time', 'attribute' => 'time',
'value' => $timeFormatter->asDateTime($model['time'], 'short'), 'value' => $timeFormatter->asDateTime($model['time'], 'short'),
],
'subject',
[
'attribute' => 'body',
'label' => 'Text body',
],
[
'attribute' => 'isSuccessful',
'label' => 'Successfully sent',
'value' => $model['isSuccessful'] ? 'Yes' : 'No'
],
'reply',
'bcc',
'cc',
[
'attribute' => 'file',
'format' => 'html',
'value' => Html::a('Download eml', ['download-mail', 'file' => $model['file']]),
],
], ],
'subject',
[
'attribute' => 'body',
'label' => 'Text body',
],
[
'attribute' => 'isSuccessful',
'label' => 'Successfully sent',
'value' => $model['isSuccessful'] ? 'Yes' : 'No'
],
'reply',
'bcc',
'cc',
[
'attribute' => 'file',
'format' => 'html',
'value' => Html::a('Download eml', ['download-mail', 'file' => $model['file']]),
],
],
]); ]);
<?php <?php
/**
* @var yii\debug\panels\MailPanel $panel
* @var yii\debug\models\search\Mail $searchModel
* @var yii\data\ArrayDataProvider $dataProvider
*/
use \yii\widgets\ListView; use \yii\widgets\ListView;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\helpers\Html; use yii\helpers\Html;
$listView = new ListView([ $listView = new ListView([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'itemView' => '_item', 'itemView' => '_item',
'layout' => "{summary}\n{items}\n{pager}\n", 'layout' => "{summary}\n{items}\n{pager}\n",
]); ]);
$listView->sorter = ['options' => ['class'=>'mail-sorter']]; $listView->sorter = ['options' => ['class' => 'mail-sorter']];
?> ?>
<h1>Email messages</h1> <h1>Email messages</h1>
<div class="row"> <div class="row">
<div class="col-lg-2"> <div class="col-lg-2">
<?= Html::button('Form filtering', ['class' => 'btn btn-default', 'onclick'=>'$("#email-form").toggle();']) ?> <?= Html::button('Form filtering', ['class' => 'btn btn-default', 'onclick' => '$("#email-form").toggle();']) ?>
</div> </div>
<div class="row col-lg-10"> <div class="row col-lg-10">
<?= $listView->renderSorter() ?> <?= $listView->renderSorter() ?>
...@@ -25,24 +31,24 @@ $listView->sorter = ['options' => ['class'=>'mail-sorter']]; ...@@ -25,24 +31,24 @@ $listView->sorter = ['options' => ['class'=>'mail-sorter']];
<div id="email-form" style="display: none;"> <div id="email-form" style="display: none;">
<?php $form = ActiveForm::begin([ <?php $form = ActiveForm::begin([
'method' => 'get', 'method' => 'get',
'action' => ['/debug/default/view', 'tag'=>\Yii::$app->request->get('tag'), 'panel'=>'mail'], 'action' => ['/debug/default/view', 'tag' => Yii::$app->request->get('tag'), 'panel' => 'mail'],
]); ?> ]); ?>
<div class="row"> <div class="row">
<?= $form->field($searchModel, 'from', ['options'=>['class'=>'col-lg-6']])->textInput() ?> <?= $form->field($searchModel, 'from', ['options' => ['class' => 'col-lg-6']])->textInput() ?>
<?= $form->field($searchModel, 'to', ['options'=>['class'=>'col-lg-6']])->textInput() ?> <?= $form->field($searchModel, 'to', ['options' => ['class' => 'col-lg-6']])->textInput() ?>
<?= $form->field($searchModel, 'reply', ['options'=>['class'=>'col-lg-6']])->textInput() ?> <?= $form->field($searchModel, 'reply', ['options' => ['class' => 'col-lg-6']])->textInput() ?>
<?= $form->field($searchModel, 'cc', ['options'=>['class'=>'col-lg-6']])->textInput() ?> <?= $form->field($searchModel, 'cc', ['options' => ['class' => 'col-lg-6']])->textInput() ?>
<?= $form->field($searchModel, 'bcc', ['options'=>['class'=>'col-lg-6']])->textInput() ?> <?= $form->field($searchModel, 'bcc', ['options' => ['class' => 'col-lg-6']])->textInput() ?>
<?= $form->field($searchModel, 'charset', ['options'=>['class'=>'col-lg-6']])->textInput() ?> <?= $form->field($searchModel, 'charset', ['options' => ['class' => 'col-lg-6']])->textInput() ?>
<?= $form->field($searchModel, 'subject', ['options'=>['class'=>'col-lg-6']])->textInput() ?> <?= $form->field($searchModel, 'subject', ['options' => ['class' => 'col-lg-6']])->textInput() ?>
<?= $form->field($searchModel, 'body', ['options'=>['class'=>'col-lg-6']])->textInput() ?> <?= $form->field($searchModel, 'body', ['options' => ['class' => 'col-lg-6']])->textInput() ?>
<div class="form-group col-lg-12"> <div class="form-group col-lg-12">
<?= Html::submitButton('Filter', ['class' => 'btn btn-success']) ?> <?= Html::submitButton('Filter', ['class' => 'btn btn-success']) ?>
......
<?php <?php
/** /**
* @var yii\debug\panels\MailPanel $panel * @var yii\debug\panels\MailPanel $panel
* @var integer $mailCount
*/ */
if ($mailCount): ?> if ($mailCount): ?>
<div class="yii-debug-toolbar-block"> <div class="yii-debug-toolbar-block">
......
<?php <?php
/**
* @var yii\debug\panels\ProfilingPanel $panel
* @var yii\debug\models\search\Profile $searchModel
* @var yii\data\ArrayDataProvider $dataProvider
* @var integer $time
* @var integer $memory
*/
use yii\grid\GridView; use yii\grid\GridView;
use yii\helpers\Html; use yii\helpers\Html;
......
<?php
/**
* @var yii\debug\panels\ProfilingPanel $panel
* @var integer $time
* @var integer $memory
*/
?>
<div class="yii-debug-toolbar-block"> <div class="yii-debug-toolbar-block">
<a href="<?= $panel->getUrl() ?>" title="Total request processing time was <?= $time ?>">Time <span class="label label-info"><?= $time ?></span></a> <a href="<?= $panel->getUrl() ?>" title="Total request processing time was <?= $time ?>">Time <span class="label label-info"><?= $time ?></span></a>
<a href="<?= $panel->getUrl() ?>" title="Peak memory consumption">Memory <span class="label label-info"><?= $memory ?></span></a> <a href="<?= $panel->getUrl() ?>" title="Peak memory consumption">Memory <span class="label label-info"><?= $memory ?></span></a>
......
<?php <?php
use yii\bootstrap\Tabs;
/** /**
* @var yii\debug\panels\RequestPanel $panel * @var yii\debug\panels\RequestPanel $panel
*/ */
use yii\bootstrap\Tabs;
echo "<h1>Request</h1>"; echo "<h1>Request</h1>";
echo Tabs::widget([ echo Tabs::widget([
......
<?php <?php
use yii\helpers\Html;
use yii\web\Response;
/** /**
* @var yii\debug\panels\RequestPanel $panel * @var yii\debug\panels\RequestPanel $panel
*/ */
use yii\helpers\Html;
use yii\web\Response;
$statusCode = $panel->data['statusCode']; $statusCode = $panel->data['statusCode'];
if ($statusCode === null) { if ($statusCode === null) {
$statusCode = 200; $statusCode = 200;
......
<?php <?php
use yii\helpers\Html;
use yii\helpers\VarDumper;
/** /**
* @var string $caption * @var string $caption
* @var array $values * @var array $values
*/ */
use yii\helpers\Html;
use yii\helpers\VarDumper;
?> ?>
<h3><?= $caption ?></h3> <h3><?= $caption ?></h3>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* @var string $tag * @var string $tag
* @var string $position * @var string $position
*/ */
use yii\helpers\Url; use yii\helpers\Url;
$minJs = <<<EOD $minJs = <<<EOD
......
<?php <?php
use yii\bootstrap\ButtonDropdown;
use yii\bootstrap\ButtonGroup;
use yii\helpers\Url;
use yii\helpers\Html;
/** /**
* @var \yii\web\View $this * @var \yii\web\View $this
* @var array $summary * @var array $summary
...@@ -14,6 +8,11 @@ use yii\helpers\Html; ...@@ -14,6 +8,11 @@ use yii\helpers\Html;
* @var \yii\debug\Panel $activePanel * @var \yii\debug\Panel $activePanel
*/ */
use yii\bootstrap\ButtonDropdown;
use yii\bootstrap\ButtonGroup;
use yii\helpers\Url;
use yii\helpers\Html;
$this->title = 'Yii Debugger'; $this->title = 'Yii Debugger';
?> ?>
<div class="default-view"> <div class="default-view">
......
...@@ -28,9 +28,13 @@ class DebugAction extends Action ...@@ -28,9 +28,13 @@ class DebugAction extends Action
*/ */
public $db; public $db;
/** /**
* @var Panel * @var DebugPanel
*/ */
public $panel; public $panel;
/**
* @var \yii\debug\controllers\DefaultController
*/
public $controller;
public function run($logId, $tag) public function run($logId, $tag)
{ {
......
...@@ -33,11 +33,17 @@ class DebugPanel extends Panel ...@@ -33,11 +33,17 @@ class DebugPanel extends Panel
]; ];
} }
/**
* @inheritdoc
*/
public function getName() public function getName()
{ {
return 'Elasticsearch'; return 'Elasticsearch';
} }
/**
* @inheritdoc
*/
public function getSummary() public function getSummary()
{ {
$timings = $this->calculateTimings(); $timings = $this->calculateTimings();
...@@ -59,6 +65,9 @@ EOD; ...@@ -59,6 +65,9 @@ EOD;
return $queryCount > 0 ? $output : ''; return $queryCount > 0 ? $output : '';
} }
/**
* @inheritdoc
*/
public function getDetail() public function getDetail()
{ {
$timings = $this->calculateTimings(); $timings = $this->calculateTimings();
......
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