Browse Source

Refactored debug module, added all missing docs

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
18be221270
  1. 2
      extensions/debug/DebugAsset.php
  2. 7
      extensions/debug/LogTarget.php
  3. 21
      extensions/debug/Module.php
  4. 5
      extensions/debug/Panel.php
  5. 56
      extensions/debug/components/search/Filter.php
  6. 40
      extensions/debug/components/search/matchers/Base.php
  7. 25
      extensions/debug/components/search/matchers/GreaterThan.php
  8. 25
      extensions/debug/components/search/matchers/LowerThan.php
  9. 39
      extensions/debug/components/search/matchers/MatcherInterface.php
  10. 34
      extensions/debug/components/search/matchers/SameAs.php
  11. 26
      extensions/debug/components/search/matches/Base.php
  12. 36
      extensions/debug/components/search/matches/Exact.php
  13. 27
      extensions/debug/components/search/matches/Greater.php
  14. 27
      extensions/debug/components/search/matches/Lower.php
  15. 25
      extensions/debug/components/search/matches/MatcherInterface.php
  16. 8
      extensions/debug/controllers/DefaultController.php
  17. 37
      extensions/debug/models/search/Base.php
  18. 23
      extensions/debug/models/search/Db.php
  19. 24
      extensions/debug/models/search/Debug.php
  20. 21
      extensions/debug/models/search/Log.php
  21. 21
      extensions/debug/models/search/Profile.php
  22. 22
      extensions/debug/panels/ConfigPanel.php
  23. 34
      extensions/debug/panels/DbPanel.php
  24. 21
      extensions/debug/panels/LogPanel.php
  25. 15
      extensions/debug/panels/ProfilingPanel.php
  26. 13
      extensions/debug/panels/RequestPanel.php

2
extensions/debug/DebugAsset.php

@ -9,6 +9,8 @@ namespace yii\debug;
use yii\web\AssetBundle;
/**
* Debugger asset bundle
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/

7
extensions/debug/LogTarget.php

@ -72,6 +72,13 @@ class LogTarget extends Target
$this->updateIndexFile($indexFile, $summary);
}
/**
* Updates index file with summary log data
*
* @param string $indexFile path to index file
* @param array $summary summary log data
* @throws \yii\base\InvalidConfigException
*/
private function updateIndexFile($indexFile, $summary)
{
touch($indexFile);

21
extensions/debug/Module.php

@ -50,7 +50,9 @@ class Module extends \yii\base\Module
*/
public $historySize = 50;
/**
* @inheritdoc
*/
public function init()
{
parent::init();
@ -69,13 +71,16 @@ class Module extends \yii\base\Module
}
}
/**
* @inheritdoc
*/
public function beforeAction($action)
{
Yii::$app->getView()->off(View::EVENT_END_BODY, [$this, 'renderToolbar']);
unset(Yii::$app->getLog()->targets['debug']);
$this->logTarget = null;
if ($this->checkAccess($action)) {
if ($this->checkAccess()) {
return parent::beforeAction($action);
} elseif ($action->id === 'toolbar') {
return false;
@ -84,6 +89,11 @@ class Module extends \yii\base\Module
}
}
/**
* Renders mini-toolbar at the end of page body.
*
* @param \yii\base\Event $event
*/
public function renderToolbar($event)
{
if (!$this->checkAccess() || Yii::$app->getRequest()->getIsAjax()) {
@ -99,6 +109,10 @@ class Module extends \yii\base\Module
echo '<script>' . $view->renderPhpFile(__DIR__ . '/assets/toolbar.js') . '</script>';
}
/**
* Checks if current user is allowed to access the module
* @return boolean if access is granted
*/
protected function checkAccess()
{
$ip = Yii::$app->getRequest()->getUserIP();
@ -111,6 +125,9 @@ class Module extends \yii\base\Module
return false;
}
/**
* @return array default set of panels
*/
protected function corePanels()
{
return [

5
extensions/debug/Panel.php

@ -73,6 +73,11 @@ class Panel extends Component
return null;
}
/**
* Loads data into the panel
*
* @param mixed $data
*/
public function load($data)
{
$this->data = $data;

56
extensions/debug/components/search/Filter.php

@ -1,33 +1,44 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search;
use yii\base\Component;
use yii\debug\components\search\matchers\MatcherInterface;
/**
* Provides array filtering capabilities.
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class Filter extends Component
{
/**
* @var array rules for matching filters in the way: [:fieldName => [rule1, rule2,..]]
*/
protected $rules = [];
/**
* Adds rules for filtering data. Match can be partial or exactly.
* Adds data filtering rule.
*
* @param string $name attribute name
* @param \yii\debug\components\search\matches\Base $rule
* @param MatcherInterface $rule
*/
public function addMatch($name, $rule)
public function addMatcher($name, MatcherInterface $rule)
{
if (empty($rule->value) && $rule->value !== 0) {
return;
if ($rule->hasValue()) {
$this->rules[$name][] = $rule;
}
$this->rules[$name][] = $rule;
}
/**
* Applies filter on given array and returns filtered data.
* Applies filter on a given array and returns filtered data.
*
* @param array $data data to filter
* @return array filtered data
*/
@ -36,7 +47,7 @@ class Filter extends Component
$filtered = [];
foreach ($data as $row) {
if ($this->checkFilter($row)) {
if ($this->passesFilter($row)) {
$filtered[] = $row;
}
}
@ -45,28 +56,25 @@ class Filter extends Component
}
/**
* Check if the given data satisfies filters.
* @param array $row
* Checks if the given data satisfies filters.
*
* @param array $row data
* @return boolean if data passed filtering
*/
public function checkFilter(array $row)
private function passesFilter(array $row)
{
$matched = true;
foreach ($row as $name => $value) {
if (isset($this->rules[$name])) {
#check all rules for given attribute
// check all rules for a given attribute
foreach ($this->rules[$name] as $rule) {
if (!$rule->check($value)) {
$matched = false;
/** @var MatcherInterface $rule */
if (!$rule->match($value)) {
return false;
}
}
}
}
return $matched;
return true;
}
}

40
extensions/debug/components/search/matchers/Base.php

@ -0,0 +1,40 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matchers;
use yii\base\Component;
/**
* Base class for matchers that are used in a filter.
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
abstract class Base extends Component implements MatcherInterface
{
/**
* @var mixed base value to check
*/
protected $baseValue;
/**
* @inheritdoc
*/
public function setValue($value)
{
$this->baseValue = $value;
}
/**
* @inheritdoc
*/
public function hasValue()
{
return !empty($this->baseValue) || $this->baseValue === 0;
}
}

25
extensions/debug/components/search/matchers/GreaterThan.php

@ -0,0 +1,25 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matchers;
/**
* Checks if the given value is greater than the base one.
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class GreaterThan extends Base
{
/**
* @inheritdoc
*/
public function match($value)
{
return ($value > $this->baseValue);
}
}

25
extensions/debug/components/search/matchers/LowerThan.php

@ -0,0 +1,25 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matchers;
/**
* Checks if the given value is lower than the base one.
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class LowerThan extends Base
{
/**
* @inheritdoc
*/
public function match($value)
{
return ($value < $this->baseValue);
}
}

39
extensions/debug/components/search/matchers/MatcherInterface.php

@ -0,0 +1,39 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matchers;
/**
* MatcherInterface should be implemented by all matchers that are used in a filter.
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
interface MatcherInterface
{
/**
* Checks if the value passed matches base value.
*
* @param mixed $value value to be matched
* @return boolean if there is a match
*/
public function match($value);
/**
* Sets base value to match against
*
* @param mixed $value
*/
public function setValue($value);
/**
* Checks if base value is set
*
* @return boolean if base value is set
*/
public function hasValue();
}

34
extensions/debug/components/search/matchers/SameAs.php

@ -0,0 +1,34 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matchers;
/**
* Checks if the given value is exactly or partially same as the base one.
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class SameAs extends Base
{
/**
* @var boolean if partial match should be used.
*/
public $partial = false;
/**
* @inheritdoc
*/
public function match($value)
{
if (!$this->partial) {
return (mb_strtolower($this->baseValue, 'utf8') == mb_strtolower($value, 'utf8'));
} else {
return (mb_strpos(mb_strtolower($value, 'utf8'), mb_strtolower($this->baseValue, 'utf8')) !== false);
}
}
}

26
extensions/debug/components/search/matches/Base.php

@ -1,26 +0,0 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matches;
use yii\base\Component;
/**
* Base mathcer class for all matchers that will be used with filter.
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
abstract class Base extends Component implements MatcherInterface
{
/**
* @var mixed current value to check for the matcher
*/
public $value;
}

36
extensions/debug/components/search/matches/Exact.php

@ -1,36 +0,0 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matches;
/**
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class Exact extends Base
{
/**
* @var boolean if current matcher should consider partial match of given value.
*/
public $partial = false;
/**
* Checks if the given value is the same as base one or has partial match with base one.
* @param mixed $value
*/
public function check($value)
{
if (!$this->partial) {
return (mb_strtolower($this->value, 'utf8') == mb_strtolower($value, 'utf8'));
} else {
return (mb_strpos(mb_strtolower($value, 'utf8'), mb_strtolower($this->value,'utf8')) !== false);
}
}
}

27
extensions/debug/components/search/matches/Greater.php

@ -1,27 +0,0 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matches;
/**
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class Greater extends Base
{
/**
* Checks if the given value is the same as base one or has partial match with base one.
* @param mixed $value
*/
public function check($value)
{
return ($value > $this->value);
}
}

27
extensions/debug/components/search/matches/Lower.php

@ -1,27 +0,0 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matches;
/**
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class Lower extends Base
{
/**
* Checks if the given value is the same as base one or has partial match with base one.
* @param mixed $value
*/
public function check($value)
{
return ($value < $this->value);
}
}

25
extensions/debug/components/search/matches/MatcherInterface.php

@ -1,25 +0,0 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\components\search\matches;
/**
* MatcherInterface is the interface that should be implemented by all matchers that will be used in filter.
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
interface MatcherInterface
{
/**
* Check if the value is correct according current matcher.
* @param mixed $value
*/
public function check($value);
}

8
extensions/debug/controllers/DefaultController.php

@ -13,11 +13,16 @@ use yii\web\NotFoundHttpException;
use yii\debug\models\search\Debug;
/**
* Debugger controller
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class DefaultController extends Controller
{
/**
* @inheritdoc
*/
public $layout = 'main';
/**
* @var \yii\debug\Module
@ -28,6 +33,9 @@ class DefaultController extends Controller
*/
public $summary;
/**
* @inheritdoc
*/
public function actions()
{
$actions = [];

37
extensions/debug/models/search/Base.php

@ -1,37 +1,44 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\models\search;
use yii\base\Model;
use yii\debug\components\search\Filter;
use yii\debug\components\search\matches;
use yii\debug\components\search\matchers;
/**
* Base search model
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class Base extends Model
{
/**
* @param Filter $filter
* @param string $attribute
* @param boolean $partial
* Adds filtering condition for a given attribute
*
* @param Filter $filter filter instance
* @param string $attribute attribute to filter
* @param boolean $partial if partial match should be used
*/
public function addCondition($filter, $attribute, $partial = false)
public function addCondition(Filter $filter, $attribute, $partial = false)
{
$value = $this->$attribute;
if (mb_strpos($value, '>') !== false) {
$value = intval(str_replace('>', '', $value));
$filter->addMatch($attribute, new matches\Greater(['value' => $value]));
$filter->addMatcher($attribute, new matchers\GreaterThan(['value' => $value]));
} elseif (mb_strpos($value, '<') !== false) {
$value = intval(str_replace('<', '', $value));
$filter->addMatch($attribute, new matches\Lower(['value' => $value]));
$filter->addMatcher($attribute, new matchers\LowerThan(['value' => $value]));
} else {
$filter->addMatch($attribute, new matches\Exact(['value' => $value, 'partial' => $partial]));
$filter->addMatcher($attribute, new matchers\SameAs(['value' => $value, 'partial' => $partial]));
}
}
}

23
extensions/debug/models/search/Db.php

@ -1,4 +1,9 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\models\search;
@ -6,13 +11,16 @@ use yii\data\ArrayDataProvider;
use yii\debug\components\search\Filter;
/**
* Db represents the model behind the search form about current request database queries.
* Search model for current request database queries.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class Db extends Base
{
/**
* @var string type attribute input search value
* @var string type of the input search value
*/
public $type;
@ -21,6 +29,9 @@ class Db extends Base
*/
public $query;
/**
* @inheritdoc
*/
public function rules()
{
return [
@ -41,8 +52,9 @@ class Db extends Base
/**
* Returns data provider with filled models. Filter applied if needed.
* @param array $params
* @param array $models
*
* @param array $params an array of parameter values indexed by parameter names
* @param array $models data to return provider for
* @return \yii\data\ArrayDataProvider
*/
public function search($params, $models)
@ -69,5 +81,4 @@ class Db extends Base
return $dataProvider;
}
}

24
extensions/debug/models/search/Debug.php

@ -1,4 +1,9 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\models\search;
@ -6,7 +11,11 @@ use yii\data\ArrayDataProvider;
use yii\debug\components\search\Filter;
/**
* Debug represents the model behind the search form about requests manifest data.
* Search model for requests manifest data.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class Debug extends Base
{
@ -51,6 +60,9 @@ class Debug extends Base
*/
public $criticalCodes = [400, 404, 500];
/**
* @inheritdoc
*/
public function rules()
{
return [
@ -76,8 +88,8 @@ class Debug extends Base
/**
* Returns data provider with filled models. Filter applied if needed.
* @param array $params
* @param array $models
* @param array $params an array of parameter values indexed by parameter names
* @param array $models data to return provider for
* @return \yii\data\ArrayDataProvider
*/
public function search($params, $models)
@ -110,13 +122,13 @@ class Debug extends Base
}
/**
* Checks if the code is critical: 400 or greater, 500 or greater.
* Checks if code is critical.
*
* @param integer $code
* @return bool
* @return boolean
*/
public function isCodeCritical($code)
{
return in_array($code, $this->criticalCodes);
}
}

21
extensions/debug/models/search/Log.php

@ -1,4 +1,9 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\models\search;
@ -6,11 +11,14 @@ use yii\data\ArrayDataProvider;
use yii\debug\components\search\Filter;
/**
* Log represents the model behind the search form about current request log.
* Search model for current request log.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class Log extends Base
{
/**
* @var string ip attribute input search value
*/
@ -26,6 +34,9 @@ class Log extends Base
*/
public $message;
/**
* @inheritdoc
*/
public function rules()
{
return [
@ -47,8 +58,9 @@ class Log extends Base
/**
* Returns data provider with filled models. Filter applied if needed.
* @param array $params
* @param array $models
*
* @param array $params an array of parameter values indexed by parameter names
* @param array $models data to return provider for
* @return \yii\data\ArrayDataProvider
*/
public function search($params, $models)
@ -73,5 +85,4 @@ class Log extends Base
return $dataProvider;
}
}

21
extensions/debug/models/search/Profile.php

@ -1,4 +1,9 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\models\search;
@ -6,11 +11,14 @@ use yii\data\ArrayDataProvider;
use yii\debug\components\search\Filter;
/**
* Profile represents the model behind the search form about current request profiling log.
* Search model for current request profiling log.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class Profile extends Base
{
/**
* @var string method attribute input search value
*/
@ -21,6 +29,9 @@ class Profile extends Base
*/
public $info;
/**
* @inheritdoc
*/
public function rules()
{
return [
@ -41,8 +52,9 @@ class Profile extends Base
/**
* Returns data provider with filled models. Filter applied if needed.
* @param array $params
* @param array $models
*
* @param array $params an array of parameter values indexed by parameter names
* @param array $models data to return provider for
* @return \yii\data\ArrayDataProvider
*/
public function search($params, $models)
@ -69,5 +81,4 @@ class Profile extends Base
return $dataProvider;
}
}

22
extensions/debug/panels/ConfigPanel.php

File diff suppressed because one or more lines are too long

34
extensions/debug/panels/DbPanel.php

@ -20,7 +20,6 @@ use yii\debug\models\search\Db;
*/
class DbPanel extends Panel
{
/**
* @var array db queries info extracted to array as models, to use with data provider.
*/
@ -31,11 +30,17 @@ class DbPanel extends Panel
*/
private $_timings;
/**
* @inheritdoc
*/
public function getName()
{
return 'Database';
}
/**
* @inheritdoc
*/
public function getSummary()
{
$timings = $this->calculateTimings();
@ -50,6 +55,9 @@ class DbPanel extends Panel
]);
}
/**
* @inheritdoc
*/
public function getDetail()
{
$searchModel = new Db();
@ -63,7 +71,8 @@ class DbPanel extends Panel
}
/**
* Calculates given request profile messages timings.
* Calculates given request profile timings.
*
* @return array timings [token, category, timestamp, traces, nesting level, elapsed time]
*/
protected function calculateTimings()
@ -74,6 +83,9 @@ class DbPanel extends Panel
return $this->_timings;
}
/**
* @inheritdoc
*/
public function save()
{
$target = $this->module->logTarget;
@ -82,7 +94,8 @@ class DbPanel extends Panel
}
/**
* Returns total queries time.
* Returns total query time.
*
* @param array $timings
* @return integer total time
*/
@ -98,8 +111,8 @@ class DbPanel extends Panel
}
/**
* Returns array of models that represents logs of the current request. Can be used with data providers,
* like yii\data\ArrayDataProvider.
* Returns an array of models that represents logs of the current request.
* Can be used with data providers such as \yii\data\ArrayDataProvider.
* @return array models
*/
protected function getModels()
@ -110,7 +123,7 @@ class DbPanel extends Panel
foreach($timings as $seq => $dbTiming) {
$this->_models[] = [
'type' => $this->detectQueryType($dbTiming['info']),
'type' => $this->getQueryType($dbTiming['info']),
'query' => $dbTiming['info'],
'duration' => ($dbTiming['duration'] * 1000), // in milliseconds
'trace' => $dbTiming['trace'],
@ -123,16 +136,15 @@ class DbPanel extends Panel
}
/**
* Detects databse timing type. Detecting is produced through simple parsing to the first space|tab|new row.
* First word before space is timing type. If there is no such words, timing will have empty type.
* Returns databse query type.
*
* @param string $timing timing procedure string
* @return string query type select|insert|delete|etc
* @return string query type such as select, insert, delete, etc.
*/
protected function detectQueryType($timing)
protected function getQueryType($timing)
{
$timing = ltrim($timing);
preg_match('/^([a-zA-z]*)/', $timing, $matches);
return count($matches) ? $matches[0] : '';
}
}

21
extensions/debug/panels/LogPanel.php

@ -20,22 +20,30 @@ use yii\debug\models\search\Log;
*/
class LogPanel extends Panel
{
/**
* @var array log messages extracted to array as models, to use with data provider.
*/
private $_models;
/**
* @inheritdoc
*/
public function getName()
{
return 'Logs';
}
/**
* @inheritdoc
*/
public function getSummary()
{
return Yii::$app->view->render('panels/log/summary', ['data' => $this->data, 'panel' => $this]);
}
/**
* @inheritdoc
*/
public function getDetail()
{
$searchModel = new Log();
@ -48,6 +56,9 @@ class LogPanel extends Panel
]);
}
/**
* @inheritdoc
*/
public function save()
{
$target = $this->module->logTarget;
@ -56,9 +67,10 @@ class LogPanel extends Panel
}
/**
* Returns array of models that represents logs of the current request. Can be used with data providers,
* like yii\data\ArrayDataProvider.
* @param boolean $refresh if needed to build models from log messages and refresh them.
* Returns an array of models that represents logs of the current request.
* Can be used with data providers, such as \yii\data\ArrayDataProvider.
*
* @param boolean $refresh if need to build models from log messages and refresh them.
* @return array models
*/
protected function getModels($refresh = false)
@ -78,5 +90,4 @@ class LogPanel extends Panel
}
return $this->_models;
}
}

15
extensions/debug/panels/ProfilingPanel.php

@ -25,11 +25,17 @@ class ProfilingPanel extends Panel
*/
private $_models;
/**
* @inheritdoc
*/
public function getName()
{
return 'Profiling';
}
/**
* @inheritdoc
*/
public function getSummary()
{
return Yii::$app->view->render('panels/profile/summary', [
@ -39,6 +45,9 @@ class ProfilingPanel extends Panel
]);
}
/**
* @inheritdoc
*/
public function getDetail()
{
$searchModel = new Profile();
@ -53,6 +62,9 @@ class ProfilingPanel extends Panel
]);
}
/**
* @inheritdoc
*/
public function save()
{
$target = $this->module->logTarget;
@ -65,7 +77,7 @@ class ProfilingPanel extends Panel
}
/**
* Returns array of profiling models that can be used in data provider.
* Returns array of profiling models that can be used in a data provider.
* @return array models
*/
protected function getModels()
@ -87,5 +99,4 @@ class ProfilingPanel extends Panel
}
return $this->_models;
}
}

13
extensions/debug/panels/RequestPanel.php

@ -19,21 +19,33 @@ use yii\debug\Panel;
*/
class RequestPanel extends Panel
{
/**
* @inheritdoc
*/
public function getName()
{
return 'Request';
}
/**
* @inheritdoc
*/
public function getSummary()
{
return Yii::$app->view->render('panels/request/summary', ['panel' => $this]);
}
/**
* @inheritdoc
*/
public function getDetail()
{
return Yii::$app->view->render('panels/request/detail', ['panel' => $this]);
}
/**
* @inheritdoc
*/
public function save()
{
$headers = Yii::$app->getRequest()->getHeaders();
@ -96,5 +108,4 @@ class RequestPanel extends Panel
'SESSION' => empty($_SESSION) ? [] : $_SESSION,
];
}
}

Loading…
Cancel
Save