DeviceDetector\DeviceDetector::discardBotInformation PHP Method

discardBotInformation() public method

(Discarding information speeds up the detection a bit)
public discardBotInformation ( boolean $discard = true )
$discard boolean
    public function discardBotInformation($discard = true)
    {
        $this->discardBotInformation = $discard;
    }

Usage Example

 /**
  * Parse UA string and fill in other attributes
  */
 public function parse()
 {
     $dd = new DeviceDetector($this->user_agent);
     // only return true if a bot was detected (speeds up detection a bit)
     $dd->discardBotInformation();
     $dd->parse();
     if ($dd->isBot()) {
         $this->bot = 1;
     } else {
         $client = $dd->getClient();
         if ($this->counts_as_bot($client)) {
             $this->bot = 1;
             return $this;
         }
         if (isset($client['name'])) {
             $this->client_name = $client['name'];
         }
         if (isset($client['version'])) {
             $this->client_version = $client['version'];
         }
         if (isset($client['type'])) {
             $this->client_type = $client['type'];
         }
         $os = $dd->getOs();
         if (isset($os['name'])) {
             $this->os_name = $os['name'];
         }
         if (isset($os['version'])) {
             $this->os_version = $os['version'];
         }
         $this->device_brand = $dd->getBrand();
         $this->device_model = $dd->getModel();
     }
     return $this;
 }
All Usage Examples Of DeviceDetector\DeviceDetector::discardBotInformation