Class yii\debug\components\search\matchers\SameAs
Inheritance | yii\debug\components\search\matchers\SameAs » yii\debug\components\search\matchers\Base » yii\base\Component |
---|---|
Implements | yii\debug\components\search\matchers\MatcherInterface |
Available since extension's version | 2.0 |
Source Code | https://github.com/yiisoft/yii2-debug/blob/master/src/components/search/matchers/SameAs.php |
Checks if the given value is exactly or partially same as the base one.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$baseValue | mixed | Base value to check | yii\debug\components\search\matchers\Base |
$partial | boolean | If partial match should be used. | yii\debug\components\search\matchers\SameAs |
Public Methods
Method | Description | Defined By |
---|---|---|
hasValue() | Checks if base value is set | yii\debug\components\search\matchers\Base |
match() | Checks if the value passed matches base value. | yii\debug\components\search\matchers\SameAs |
setValue() | Sets base value to match against | yii\debug\components\search\matchers\Base |
Property Details
Method Details
Defined in: yii\debug\components\search\matchers\Base::hasValue()
Checks if base value is set
public boolean hasValue ( ) | ||
return | boolean |
If base value is set |
---|
public function hasValue()
{
return !empty($this->baseValue) || ($this->baseValue === '0');
}
Checks if the value passed matches base value.
public boolean match ( $value ) | ||
$value | mixed |
Value to be matched |
return | boolean |
If there is a match |
---|
public function match($value)
{
if (!is_scalar($value)) {
$value = VarDumper::export($value);
}
if ($this->partial) {
return mb_stripos($value, $this->baseValue, 0, \Yii::$app->charset) !== false;
}
return strcmp(mb_strtoupper($this->baseValue, \Yii::$app->charset), mb_strtoupper($value, \Yii::$app->charset)) === 0;
}
Defined in: yii\debug\components\search\matchers\Base::setValue()
Sets base value to match against
public void setValue ( $value ) | ||
$value | mixed |
public function setValue($value)
{
$this->baseValue = $value;
}