BcAgent::isMatchDecisionKey PHP Метод

isMatchDecisionKey() публичный Метод

ユーザーエージェントがキーワードを含むかどうかを判定
public isMatchDecisionKey ( ) : boolean
Результат boolean
    public function isMatchDecisionKey()
    {
        $key = env('HTTP_USER_AGENT');
        $regex = $this->getDetectorRegex();
        return (bool) preg_match($regex, $key);
    }

Usage Example

Пример #1
0
 /**
  * URLがエージェント用かどうかを判定
  *
  * @param bool $expect 期待値
  * @param string $userAgent ユーザーエージェントの文字列
  * @return void
  * @dataProvider isMatchDecisionKeyDataProvider
  */
 public function testIsMatchDecisionKey($expect, $userAgent)
 {
     $_SERVER['HTTP_USER_AGENT'] = $userAgent;
     $this->assertEquals($expect, $this->agent->isMatchDecisionKey());
 }