Commit dc9f9d92 by Klimov Paul

Doc comments and code style for 'debug' extension adjusted

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