Example #1
0
 /**
  * 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';
 }
Example #2
0
 /**
  * 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';
 }