Exemplo n.º 1
0
 /**
  * @param string $userAgent
  *
  * @return null|string
  */
 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = Utils::toleranceToRisDelimeter($userAgent);
     if ($tolerance !== false) {
         return $this->getDeviceIDFromRIS($userAgent, $tolerance);
     }
     $tolerance = Utils::firstSlash($userAgent);
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 2
0
 /**
  * Attempt to find a conclusive match for the given $userAgent
  *
  * @param string $userAgent
  *
  * @return string Matching WURFL deviceID
  */
 public function applyConclusiveMatch($userAgent)
 {
     if (Utils::checkIfContains($userAgent, 'GoogleImageProxy')) {
         return 'google_image_proxy';
     }
     if (Utils::checkIfStartsWith($userAgent, 'Mozilla')) {
         $tolerance = Utils::firstCloseParen($userAgent);
     } else {
         $tolerance = Utils::firstSlash($userAgent);
     }
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
0
 /**
  * Find a matching WURFL device from the given $userAgent. Override this method to give an alternative way to do
  * the matching
  *
  * @param string $userAgent
  *
  * @return string
  */
 public function lookForMatchingUserAgent($userAgent)
 {
     $tolerance = Utils::firstSlash($userAgent);
     return Utils::risMatch($this->userAgents, $userAgent, $tolerance);
 }
Exemplo n.º 5
0
 /**
  * @param string $userAgent
  *
  * @return null|string
  */
 public function applyConclusiveMatch($userAgent)
 {
     $tolerance = Utils::firstSlash($userAgent);
     return $this->getDeviceIDFromRIS($userAgent, $tolerance);
 }
Exemplo n.º 6
0
 public function testFirstSlash()
 {
     $this->assertEquals(6, Utils::firstSlash('Value/12'));
     $this->assertNull(Utils::firstSlash('Value'));
 }