Class yii\debug\models\search\Debug

Inheritanceyii\debug\models\search\Debug » yii\debug\models\search\Base » yii\base\Model
Available since extension's version2.0
Source Code https://github.com/yiisoft/yii2-debug/blob/master/src/models/search/Debug.php

Search model for requests manifest data.

Public Properties

Hide inherited properties

Property Type Description Defined By
$ajax integer Ajax attribute input search value yii\debug\models\search\Debug
$criticalCodes array Critical codes, used to determine grid row options. yii\debug\models\search\Debug
$ip string Ip attribute input search value yii\debug\models\search\Debug
$mailCount integer Total mail count attribute input search value yii\debug\models\search\Debug
$method string Method attribute input search value yii\debug\models\search\Debug
$sqlCount integer Sql count attribute input search value yii\debug\models\search\Debug
$statusCode string Status code attribute input search value yii\debug\models\search\Debug
$tag string Tag attribute input search value yii\debug\models\search\Debug
$url string Url attribute input search value yii\debug\models\search\Debug

Public Methods

Hide inherited methods

Method Description Defined By
addCondition() Adds filtering condition for a given attribute yii\debug\models\search\Base
attributeLabels() yii\debug\models\search\Debug
isCodeCritical() Checks if code is critical. yii\debug\models\search\Debug
rules() yii\debug\models\search\Debug
search() Returns data provider with filled models. Filter applied if needed. yii\debug\models\search\Debug

Property Details

Hide inherited properties

$ajax public property

Ajax attribute input search value

public integer $ajax null
$criticalCodes public property

Critical codes, used to determine grid row options.

public array $criticalCodes = [
    
400,
    
404,
    
500,
]
$ip public property

Ip attribute input search value

public string $ip null
$mailCount public property

Total mail count attribute input search value

public integer $mailCount null
$method public property

Method attribute input search value

public string $method null
$sqlCount public property

Sql count attribute input search value

public integer $sqlCount null
$statusCode public property

Status code attribute input search value

public string $statusCode null
$tag public property

Tag attribute input search value

public string $tag null
$url public property

Url attribute input search value

public string $url null

Method Details

Hide inherited methods

addCondition() public method

Defined in: yii\debug\models\search\Base::addCondition()

Adds filtering condition for a given attribute

public void addCondition ( yii\debug\components\search\Filter $filter, $attribute, $partial false )
$filter yii\debug\components\search\Filter

Filter instance

$attribute string

Attribute to filter

$partial boolean

If partial match should be used

                public function addCondition(Filter $filter, $attribute, $partial = false)
{
    $value = $this->$attribute;
    if (mb_strpos($value, '>') !== false) {
        $value = (int) str_replace('>', '', $value);
        $filter->addMatcher($attribute, new matchers\GreaterThan(['value' => $value]));
    } elseif (mb_strpos($value, '<') !== false) {
        $value = (int) str_replace('<', '', $value);
        $filter->addMatcher($attribute, new matchers\LowerThan(['value' => $value]));
    } else {
        $filter->addMatcher($attribute, new matchers\SameAs(['value' => $value, 'partial' => $partial]));
    }
}

            
attributeLabels() public method

public void attributeLabels ( )

                public function attributeLabels()
{
    return [
        'tag' => 'Tag',
        'ip' => 'Ip',
        'method' => 'Method',
        'ajax' => 'Ajax',
        'url' => 'url',
        'statusCode' => 'Status code',
        'sqlCount' => 'Query Count',
        'mailCount' => 'Mail Count',
    ];
}

            
isCodeCritical() public method

Checks if code is critical.

public boolean isCodeCritical ( $code )
$code integer

                public function isCodeCritical($code)
{
    return in_array($code, $this->criticalCodes, false);
}

            
rules() public method

public void rules ( )

                public function rules()
{
    return [
        [['tag', 'ip', 'method', 'ajax', 'url', 'statusCode', 'sqlCount', 'mailCount'], 'safe'],
    ];
}

            
search() public method

Returns data provider with filled models. Filter applied if needed.

public \yii\data\ArrayDataProvider search ( $params, $models )
$params array

An array of parameter values indexed by parameter names

$models array

Data to return provider for

                public function search($params, $models)
{
    $dataProvider = new ArrayDataProvider([
        'allModels' => $models,
        'sort' => [
            'attributes' => ['method', 'ip', 'tag', 'time', 'statusCode', 'sqlCount', 'mailCount'],
        ],
        'pagination' => [
            'pageSize' => 50,
        ],
    ]);
    if (!($this->load($params) && $this->validate())) {
        return $dataProvider;
    }
    $filter = new Filter();
    $this->addCondition($filter, 'tag', true);
    $this->addCondition($filter, 'ip', true);
    $this->addCondition($filter, 'method');
    $this->addCondition($filter, 'ajax');
    $this->addCondition($filter, 'url', true);
    $this->addCondition($filter, 'statusCode');
    $this->addCondition($filter, 'sqlCount');
    $this->addCondition($filter, 'mailCount');
    $dataProvider->allModels = $filter->filter($models);
    return $dataProvider;
}