protected static function detectDevice()
  {
    $detect = new MobileDetect();
    self::$detectCode = array();
    self::$detectCode['tablet'] = $detect->isTablet();
    self::$detectCode['mobile'] = $detect->isMobile() && !$detect->isTablet();
    self::$detectCode['desktop'] = !self::$detectCode['tablet'] && !self::$detectCode['mobile'];
    self::$detectCode['device'] = 'desktop';
    foreach ($detect->getRules() as $name => $regex) {
      if ($detect->{'is' . $name}()) {
        self::$detectCode['device'] = $name;
        break;
      }
    }
  }