예제 #1
0
 /**
  * @param \Wurfl\Request\GenericRequest $request
  */
 public function __construct(GenericRequest $request)
 {
     $this->httpRequest = $request;
     $this->deviceUa = $this->httpRequest->getDeviceUserAgent();
     $this->browserUa = $this->httpRequest->getBrowserUserAgent();
     $this->deviceUaNormalized = $this->httpRequest->getUserAgentNormalized();
     $this->browserUaNormalized = $this->deviceUaNormalized;
     $this->browser = new NameVersionPair($this);
     $this->os = new NameVersionPair($this);
 }
예제 #2
0
 /**
  * Adds the user agent hash and user agent to a list for retrieval
  *
  * @param \Wurfl\Request\GenericRequest $request
  * @param \stdClass                     $info
  */
 private function addToUAList(GenericRequest $request, \stdClass $info)
 {
     $uaList = $this->getUaList();
     if (isset($uaList[$info->uaHash])) {
         return;
     }
     // merge the old list with the new user agent
     $mergedInfo = (object) array_merge($uaList, array($info->uaHash => $request->getBrowserUserAgent()));
     // write out the data to the user agent list
     $uaListJSON = json_encode($mergedInfo);
     file_put_contents(__DIR__ . '/user-agents/ua.list.json', $uaListJSON);
 }