/** * Returns the stat handler value. * * @return string */ public function getValue() { $location = $this->geoIp->getGeoIpLocation($this->statHandlerObject->getIp()); if ($location) { return $location->getCountryCode(); } }
/** * Returns the stat handler value. * * @return string */ public function getValue() { $detect = new \Mobile_Detect($this->statHandlerObject->getHeaders(), $this->statHandlerObject->getUserAgent()); if ($detect->isMobile() && !$detect->isTablet()) { return 'mobile'; } elseif ($detect->isTablet()) { return 'tablet'; } return 'desktop'; }
/** * Returns the stat handler value. * * @return string */ public function getValue() { $ua = strtolower($this->statHandlerObject->getUserAgent()); foreach ($this->browsers as $pattern => $name) { if (preg_match('/' . $pattern . '/', $ua)) { return $name; } } return 'other'; }
/** * Set http request headers, otherwise use the headers from the current http request. * * @param array $headers List of http request headers. */ public function setHeaders($headers) { $this->statHandlerObject->setHeaders($headers); }