You are here

private function MobileDeviceDetection::version in Mobile Device Detection 8.3

Same name and namespace in other branches
  1. 8.2 src/Object/MobileDeviceDetection.php \Drupal\mobile_device_detection\Object\MobileDeviceDetection::version()

Versions.

2 calls to MobileDeviceDetection::version()
MobileDeviceDetection::getBrowser in src/Object/MobileDeviceDetection.php
Get browser.
MobileDeviceDetection::getOperatingSystem in src/Object/MobileDeviceDetection.php
Get operating system.

File

src/Object/MobileDeviceDetection.php, line 286

Class

MobileDeviceDetection
MobileDeviceDetection object.

Namespace

Drupal\mobile_device_detection\Object

Code

private function version($name) {
  $properties = (array) $this
    ->getAttributes()
    ->get('properties')[$name];
  foreach ($properties as $value) {
    $pattern = str_replace('[VER]', $this
      ->getAttributes()
      ->get('VER'), $value);
    preg_match(sprintf('#%s#is', $pattern), $this
      ->getUserAgentHeaders(), $matches);
    if (!empty($matches)) {
      $this->object->{$name}[] = $matches;
    }
  }
}