You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
837B

  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\debug\components\search\matchers;
  8. /**
  9. * Checks if the given value is exactly or partially same as the base one.
  10. *
  11. * @author Mark Jebri <mark.github@yandex.ru>
  12. * @since 2.0
  13. */
  14. class SameAs extends Base
  15. {
  16. /**
  17. * @var boolean if partial match should be used.
  18. */
  19. public $partial = false;
  20. /**
  21. * @inheritdoc
  22. */
  23. public function match($value)
  24. {
  25. if ($this->partial) {
  26. return mb_stripos($value, $this->baseValue, 0, \Yii::$app->charset) !== false;
  27. } else {
  28. return strcmp(mb_strtoupper($this->baseValue, \Yii::$app->charset), mb_strtoupper($value, \Yii::$app->charset)) === 0;
  29. }
  30. }
  31. }