Wap.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace WhichBrowser\Analyser\Header;
  3. use WhichBrowser\Constants;
  4. use WhichBrowser\Data;
  5. class Wap
  6. {
  7. public function __construct($header, &$data)
  8. {
  9. $this->data =& $data;
  10. $header = trim($header);
  11. if ($header[0] == '"') {
  12. $header = explode(",", $header);
  13. $header = trim($header[0], '"');
  14. }
  15. $result = Data\DeviceProfiles::identify($header);
  16. if ($result) {
  17. $this->data->device->manufacturer = $result[0];
  18. $this->data->device->model = $result[1];
  19. $this->data->device->identified |= Constants\Id::MATCH_PROF;
  20. if (!empty($result[2]) && (!isset($this->data->os->name) || $this->data->os->name != $result[2])) {
  21. $this->data->os->name = $result[2];
  22. $this->data->os->version = null;
  23. $this->data->engine->name = null;
  24. $this->data->engine->version = null;
  25. }
  26. if (isset($result[3])) {
  27. $this->data->device->type = $result[3];
  28. }
  29. }
  30. }
  31. }