Signage.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace WhichBrowser\Analyser\Header\Useragent\Device;
  3. use WhichBrowser\Constants;
  4. trait Signage
  5. {
  6. private function detectSignage($ua)
  7. {
  8. if (!preg_match('/(BrightSign|ADAPI)/ui', $ua)) {
  9. return;
  10. }
  11. /* BrightSign */
  12. if (preg_match('/BrightSign\/[0-9\.]+(?:-[a-z0-9\-]+)? \(([^\)]+)/u', $ua, $match)) {
  13. $this->data->os->reset();
  14. $this->data->device->setIdentification([
  15. 'manufacturer' => 'BrightSign',
  16. 'model' => $match[1],
  17. 'type' => Constants\DeviceType::SIGNAGE
  18. ]);
  19. }
  20. /* Iadea */
  21. if (preg_match('/ADAPI/u', $ua) && preg_match('/\(MODEL:([^\)]+)\)/u', $ua, $match)) {
  22. if (!$this->data->isOs('Android')) {
  23. $this->data->os->reset();
  24. }
  25. $this->data->device->setIdentification([
  26. 'manufacturer' => 'IAdea',
  27. 'model' => $match[1],
  28. 'type' => Constants\DeviceType::SIGNAGE
  29. ]);
  30. }
  31. }
  32. }