DeviceDetector\DeviceDetector::isDesktop PHP Méthode

isDesktop() public méthode

Returns if the parsed UA was identified as desktop device Desktop devices are all devices with an unknown type that are running a desktop os
See also: self::$desktopOsArray
public isDesktop ( ) : boolean
Résultat boolean
    public function isDesktop()
    {
        $osShort = $this->getOs('short_name');
        if (empty($osShort) || self::UNKNOWN == $osShort) {
            return false;
        }
        // Check for browsers available for mobile devices only
        if ($this->usesMobileBrowser()) {
            return false;
        }
        $decodedFamily = OperatingSystem::getOsFamily($osShort);
        return in_array($decodedFamily, self::$desktopOsArray);
    }

Usage Example

 /**
  * @dataProvider getUserAgents
  */
 public function testTypeMethods($useragent, $isBot, $isMobile, $isDesktop)
 {
     $dd = new DeviceDetector($useragent);
     $dd->discardBotInformation();
     $dd->parse();
     $this->assertEquals($isBot, $dd->isBot());
     $this->assertEquals($isMobile, $dd->isMobile());
     $this->assertEquals($isDesktop, $dd->isDesktop());
 }
All Usage Examples Of DeviceDetector\DeviceDetector::isDesktop