/**
  * @dataProvider getFixtures
  */
 public function testParse($useragent, $vendor)
 {
     $vfParser = new VendorFragment();
     $vfParser->setUserAgent($useragent);
     $this->assertEquals($vendor, $vfParser->parse());
     self::$regexesTested[] = $vfParser->getMatchedRegex();
 }
 protected function parseDevice()
 {
     $parsers = $this->getDeviceParsers();
     foreach ($parsers as $parser) {
         $parser->setCache($this->getCache());
         $parser->setUserAgent($this->getUserAgent());
         if ($parser->parse()) {
             $this->device = $parser->getDeviceType();
             $this->model = $parser->getModel();
             $this->brand = $parser->getBrand();
             break;
         }
     }
     /**
      * If no brand has been assigned try to match by known vendor fragments
      */
     if (empty($this->brand)) {
         $vendorParser = new VendorFragment($this->getUserAgent());
         $this->brand = $vendorParser->parse();
     }
     /**
      * Some user agents simply contain the fragment 'Android; Tablet;', so we assume those devices as tablets
      */
     if (is_null($this->device) && $this->hasAndroidTableFragment()) {
         $this->device = DeviceParserAbstract::DEVICE_TYPE_TABLET;
     }
     /**
      * Some user agents simply contain the fragment 'Android; Mobile;', so we assume those devices as smartphones
      */
     if (is_null($this->device) && $this->hasAndroidMobileFragment()) {
         $this->device = DeviceParserAbstract::DEVICE_TYPE_SMARTPHONE;
     }
     $osShortName = $this->getOs('short_name');
     $osFamily = OperatingSystem::getOsFamily($osShortName);
     $osVersion = $this->getOs('version');
     /**
      * Android up to 3.0 was designed for smartphones only. But as 3.0, which was tablet only, was published
      * too late, there were a bunch of tablets running with 2.x
      * With 4.0 the two trees were merged and it is for smartphones and tablets
      *
      * So were are expecting that all devices running Android < 2 are smartphones
      * Devices running Android 3.X are tablets. Device type of Android 2.X and 4.X+ are unknown
      */
     if (is_null($this->device) && $osShortName == 'AND' && $osVersion != '') {
         if (version_compare($osVersion, '2.0') == -1) {
             $this->device = DeviceParserAbstract::DEVICE_TYPE_SMARTPHONE;
         } elseif (version_compare($osVersion, '3.0') >= 0 and version_compare($osVersion, '4.0') == -1) {
             $this->device = DeviceParserAbstract::DEVICE_TYPE_TABLET;
         }
     }
     /**
      * All detected feature phones running android are more likely a smartphone
      */
     if ($this->device == DeviceParserAbstract::DEVICE_TYPE_FEATURE_PHONE && $osFamily == 'Android') {
         $this->device = DeviceParserAbstract::DEVICE_TYPE_SMARTPHONE;
     }
     /**
      * According to http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx
      * Internet Explorer 10 introduces the "Touch" UA string token. If this token is present at the end of the
      * UA string, the computer has touch capability, and is running Windows 8 (or later).
      * This UA string will be transmitted on a touch-enabled system running Windows 8 (RT)
      *
      * As most touch enabled devices are tablets and only a smaller part are desktops/notebooks we assume that
      * all Windows 8 touch devices are tablets.
      */
     if (is_null($this->device) && ($osShortName == 'WRT' || $osShortName == 'WIN' && version_compare($osVersion, '8.0')) && $this->isTouchEnabled()) {
         $this->device = DeviceParserAbstract::DEVICE_TYPE_TABLET;
     }
     // set device type to desktop for all devices running a desktop os that were not detected as an other device type
     if (is_null($this->device) && $this->isDesktop()) {
         $this->device = DeviceParserAbstract::DEVICE_TYPE_DESKTOP;
     }
 }