Пример #1
0
 public function testMagicMMethods()
 {
     $ua = 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.136 Mobile Safari/537.36';
     $dd = new DeviceDetector($ua);
     $dd->parse();
     $this->assertTrue($dd->isSmartphone());
     $this->assertFalse($dd->isFeaturePhone());
     $this->assertFalse($dd->isTablet());
     $this->assertFalse($dd->isPhablet());
     $this->assertFalse($dd->isCarBrowser());
     $this->assertFalse($dd->isSmartDisplay());
     $this->assertFalse($dd->isTV());
     $this->assertFalse($dd->isConsole());
     $this->assertFalse($dd->isPortableMediaPlayer());
     $this->assertFalse($dd->isCamera());
     $this->assertTrue($dd->isBrowser());
     $this->assertFalse($dd->isLibrary());
     $this->assertFalse($dd->isMediaPlayer());
     $this->assertFalse($dd->isMobileApp());
     $this->assertFalse($dd->isPIM());
     $this->assertFalse($dd->isFeedReader());
 }
 /**
  *
  * @param DeviceDetector $dd
  *
  * @return array
  */
 private function getResultRaw(DeviceDetector $dd)
 {
     $raw = ['client' => $dd->getClient(), 'operatingSystem' => $dd->getOs(), 'device' => ['brand' => $dd->getBrand(), 'brandName' => $dd->getBrandName(), 'model' => $dd->getModel(), 'device' => $dd->getDevice(), 'deviceName' => $dd->getDeviceName()], 'bot' => $dd->getBot(), 'extra' => ['isBot' => $dd->isBot(), 'isBrowser' => $dd->isBrowser(), 'isFeedReader' => $dd->isFeedReader(), 'isMobileApp' => $dd->isMobileApp(), 'isPIM' => $dd->isPIM(), 'isLibrary' => $dd->isLibrary(), 'isMediaPlayer' => $dd->isMediaPlayer(), 'isCamera' => $dd->isCamera(), 'isCarBrowser' => $dd->isCarBrowser(), 'isConsole' => $dd->isConsole(), 'isFeaturePhone' => $dd->isFeaturePhone(), 'isPhablet' => $dd->isPhablet(), 'isPortableMediaPlayer' => $dd->isPortableMediaPlayer(), 'isSmartDisplay' => $dd->isSmartDisplay(), 'isSmartphone' => $dd->isSmartphone(), 'isTablet' => $dd->isTablet(), 'isTV' => $dd->isTV(), 'isDesktop' => $dd->isDesktop(), 'isMobile' => $dd->isMobile(), 'isTouchEnabled' => $dd->isTouchEnabled()]];
     return $raw;
 }