/** * @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); }
/** * 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); }
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); }
/** * 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); }
/** * @param string $userAgent * * @return null|string */ public function applyConclusiveMatch($userAgent) { $tolerance = Utils::firstSlash($userAgent); return $this->getDeviceIDFromRIS($userAgent, $tolerance); }
public function testFirstSlash() { $this->assertEquals(6, Utils::firstSlash('Value/12')); $this->assertNull(Utils::firstSlash('Value')); }