You are here

private function MobileDeviceDetection::version in Mobile Device Detection 8.2

Same name and namespace in other branches
  1. 8.3 src/Object/MobileDeviceDetection.php \Drupal\mobile_device_detection\Object\MobileDeviceDetection::version()
2 calls to MobileDeviceDetection::version()
MobileDeviceDetection::getBrowser in src/Object/MobileDeviceDetection.php
MobileDeviceDetection::getOperatingSystem in src/Object/MobileDeviceDetection.php

File

src/Object/MobileDeviceDetection.php, line 249

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;
    }
  }
}