Example #1
0
 public function testShouldReturnNegativeOneForInexistantChar()
 {
     $haystack = 'Mozilla/4.0 (compatible; MSIE 4.0; Windows 95; .NET CLR 1.1.4322; .NET CLR 2.0.50727)';
     $needle = ':';
     $expected = Utils::ordinalIndexOf($haystack, $needle, 1);
     self::assertEquals(-1, $expected);
 }
Example #2
0
 public function applyConclusiveMatch($userAgent)
 {
     if (Utils::checkIfContains($userAgent, 'BB10')) {
         $tolerance = Utils::indexOfOrLength($userAgent, ')');
     } else {
         if (Utils::checkIfStartsWith($userAgent, 'Mozilla/4')) {
             $tolerance = Utils::secondSlash($userAgent);
         } else {
             if (Utils::checkIfStartsWith($userAgent, 'Mozilla/5')) {
                 $tolerance = Utils::ordinalIndexOf($userAgent, ';', 3);
             } elseif (Utils::checkIfStartsWith($userAgent, 'PlayBook')) {
                 $tolerance = Utils::firstCloseParen($userAgent);
             } else {
                 $tolerance = Utils::firstSlash($userAgent);
             }
         }
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }