DeviceDetector.php
public static function getInfoFromUserAgent($ua)
    {
        $deviceDetector = new DeviceDetector($ua);
        $deviceDetector->parse();

        if ($deviceDetector->isBot()) {
            return array(
                'user_agent' => $deviceDetector->getUserAgent(),
                'bot' => $deviceDetector->getBot()
            );
        }

        $osFamily = OperatingSystem::getOsFamily($deviceDetector->getOs('short_name'));
        $browserFamily = \DeviceDetector\Parser\Client\Browser::getBrowserFamily($deviceDetector->getClient('short_name'));

        $processed = array(
            'user_agent' => $deviceDetector->getUserAgent(),
            'os' => $deviceDetector->getOs(),
            'client' => $deviceDetector->getClient(),
            'device' => array(
                'type' => $deviceDetector->getDeviceName(),
                'brand' => $deviceDetector->getBrand(),
                'model' => $deviceDetector->getModel(),
            ),
            'os_family' => $osFamily !== false ? $osFamily : 'Unknown',
            'browser_family' => $browserFamily !== false ? $browserFamily : 'Unknown',
        );
        return $processed;
    }
public static function getInfoFromUserAgent($ua)
    {
        $deviceDetector = new DeviceDetector($ua);
        $deviceDetector->parse();

        if ($deviceDetector->isBot()) {
            return array(
                'user_agent' => $deviceDetector->getUserAgent(),
                'bot' => $deviceDetector->getBot()
            );
        }

        $osFamily = OperatingSystem::getOsFamily($deviceDetector->getOs('short_name'));
        $browserFamily = \DeviceDetector\Parser\Client\Browser::getBrowserFamily($deviceDetector->getClient('short_name'));

        $processed = array(
            'user_agent' => $deviceDetector->getUserAgent(),
            'os' => $deviceDetector->getOs(),
            'client' => $deviceDetector->getClient(),
            'device' => array(
                'type' => $deviceDetector->getDeviceName(),
                'brand' => $deviceDetector->getBrand(),
                'model' => $deviceDetector->getModel(),
            ),
            'os_family' => $osFamily !== false ? $osFamily : 'Unknown',
            'browser_family' => $browserFamily !== false ? $browserFamily : 'Unknown',
        );
        return $processed;
    }
public static function getInfoFromUserAgent ( $ ua ) { $ deviceDetector = new DeviceDetector ( $ ua ) ; $ deviceDetector -> parse ( ) ; if ( $ deviceDetector -> isBot ( ) ) { return array ( 'user_agent' => $ deviceDetector -> getUserAgent ( ) , 'bot' => $ deviceDetector -> getBot ( ) ) ; } $ osFamily = OperatingSystem :: getOsFamily ( $ deviceDetector -> getOs ( 'short_name' ) ) ; $ browserFamily = \ DeviceDetector \ Parser \ Client \ Browser :: getBrowserFamily ( $ deviceDetector -> getClient ( 'short_name' ) ) ; $ processed = array ( 'user_agent' => $ deviceDetector -> getUserAgent ( ) , 'os' => $ deviceDetector -> getOs ( ) , 'client' => $ deviceDetector -> getClient ( ) , 'device' => array ( 'type' => $ deviceDetector -> getDeviceName ( ) , 'brand' => $ deviceDetector -> getBrand ( ) , 'model' => $ deviceDetector -> getModel ( ) , ) , 'os_family' => $ osFamily !== false ? $ osFamily : 'Unknown' , 'browser_family' => $ browserFamily !== false ? $ browserFamily : 'Unknown' , ) ; return $ processed ; }
Parses a useragent and returns the detected data

ATTENTION: Use that method only for testing or very small applications
To get fast results from DeviceDetector you need to make your own implementation,
that should use one of the caching mechanisms. See README.md for more information.

@internal
@deprecated

@param string $ua UserAgent to parse

@return array
Parses a useragent and returns the detected data