コード例 #1
0
ファイル: NokiaHandler.php プロジェクト: mimmi20/wurfl
 /**
  * @param string $userAgent
  *
  * @return null|string
  */
 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = Utils::indexOfAnyOrLength($userAgent, array('/', ' '), strpos($userAgent, 'Nokia'));
     if (Utils::checkIfStartsWithAnyOf($userAgent, array('Nokia/', 'Nokia '))) {
         $tolerance = strlen($userAgent);
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
コード例 #2
0
ファイル: AndroidHandler.php プロジェクト: mimmi20/wurfl
 /**
  * @param string $userAgent
  *
  * @return null|string
  */
 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = Utils::toleranceToRisDelimeter($userAgent);
     if ($tolerance !== false) {
         return $this->getDeviceIDFromRIS($userAgent, $tolerance);
     }
     //Return no match for UAs with no extractable Android version, model and that do not start with either Mozilla or Dalvik
     if (!Utils::checkIfStartsWithAnyOf($userAgent, array('Mozilla', 'Dalvik'))) {
         return WurflConstants::NO_MATCH;
     }
     if (self::getAndroidModel($userAgent, false) === null) {
         return $this->getDeviceIDFromRIS($userAgent, strlen($userAgent));
     }
     // Standard RIS Matching
     $tolerance = Utils::indexOfAnyOrLength($userAgent, array(' Build/', ' AppleWebKit'));
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
コード例 #3
0
ファイル: UtilsTest.php プロジェクト: mimmi20/wurfl
 /**
  * @dataProvider indexOfAnyOrLengthDataProvider
  *
  * @param string $haystack
  * @param string $expected
  */
 public function testIndexOfAnyOrLength($haystack, $expected)
 {
     $found = Utils::indexOfAnyOrLength($haystack, array(' ', '/'), 0);
     self::assertEquals($expected, $found);
 }