private function _lookupDB($ua)
    {
        $browser = new Browser();
        $browser->setGrade(Grades::UNSUPPORTED);

        $conn = new \Mongo('mongodb://'.DeviceManager::HOST);
        $collection = $conn->selectDB(DeviceManager::DB)->devices;

        // Determine Regex fitting the U/A Category. 
        $pattern = $this->_getMatchingRegex($ua);
        $uaRegex = new \MongoRegex($pattern);

        //$device = $collection->findOne(array("userAgent"=>$nameRegex));
        // Match User Agent independent of OS Version, Check OS Version >= Base Matching Version
        $device = $collection->findOne(
            array (
                '$and'=>array (
                    array ("userAgent"=>$uaRegex), 
                    array ('$or'=> array(
                        array("device.os.version"=>array('$exists'=>false)),
                        array("device.os.version"=>array('$lte'=>"".$ua->osVersion))
                    ))
                )
            )
        );

        if (!empty($device)) {
            $browser = $this->_createBrowser($device);
        } else {
            // TODO : Request for Browser Categorization 
        }
        return $browser;
    }
private function _lookupDB($ua)
    {
        $browser = new Browser();
        $browser->setGrade(Grades::UNSUPPORTED);

        $conn = new \Mongo('mongodb://'.DeviceManager::HOST);
        $collection = $conn->selectDB(DeviceManager::DB)->devices;

        // Determine Regex fitting the U/A Category. 
        $pattern = $this->_getMatchingRegex($ua);
        $uaRegex = new \MongoRegex($pattern);

        //$device = $collection->findOne(array("userAgent"=>$nameRegex));
        // Match User Agent independent of OS Version, Check OS Version >= Base Matching Version
        $device = $collection->findOne(
            array (
                '$and'=>array (
                    array ("userAgent"=>$uaRegex), 
                    array ('$or'=> array(
                        array("device.os.version"=>array('$exists'=>false)),
                        array("device.os.version"=>array('$lte'=>"".$ua->osVersion))
                    ))
                )
            )
        );

        if (!empty($device)) {
            $browser = $this->_createBrowser($device);
        } else {
            // TODO : Request for Browser Categorization 
        }
        return $browser;
    }
private function _lookupDB ( $ ua ) { $ browser = new Browser ( ) ; $ browser -> setGrade ( Grades :: UNSUPPORTED ) ; $ conn = new \ Mongo ( 'mongodb://' . DeviceManager :: HOST ) ; $ collection = $ conn -> selectDB ( DeviceManager :: DB ) -> devices ; // Determine Regex fitting the U/A Category.  $ pattern = $ this -> _getMatchingRegex ( $ ua ) ; $ uaRegex = new \ MongoRegex ( $ pattern ) ; //$device = $collection->findOne(array("userAgent"=>$nameRegex)); // Match User Agent independent of OS Version, Check OS Version >= Base Matching Version $ device = $ collection -> findOne ( array ( '$and' => array ( array ( "userAgent" => $ uaRegex ) , array ( '$or' => array ( array ( "device.os.version" => array ( '$exists' => false ) ) , array ( "device.os.version" => array ( '$lte' => "" . $ ua -> osVersion ) ) ) ) ) ) ) ; if ( ! empty ( $ device ) ) { $ browser = $ this -> _createBrowser ( $ device ) ; } else { // TODO : Request for Browser Categorization  } return $ browser ; }
Finds closest match given the user agent

@param mixed $ua : User Agent Object parsed using UA

@access private
@return void
Finds closest match given the user agent