Cars.php 660 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace WhichBrowser\Analyser\Header\Useragent\Device;
  3. use WhichBrowser\Constants;
  4. trait Cars
  5. {
  6. private function detectCars($ua)
  7. {
  8. if (!preg_match('/Car/ui', $ua)) {
  9. return;
  10. }
  11. $this->detectTesla($ua);
  12. }
  13. /* Tesla S */
  14. private function detectTesla($ua)
  15. {
  16. if (preg_match('/QtCarBrowser/u', $ua)) {
  17. $this->data->os->reset();
  18. $this->data->device->setIdentification([
  19. 'manufacturer' => 'Tesla',
  20. 'model' => 'Model S',
  21. 'type' => Constants\DeviceType::CAR
  22. ]);
  23. }
  24. }
  25. }