Returns client device details from client browser

@param class $deviceDetectorClass
@return array
761043
private function getClientBrowserDevice(\DeviceDetector\DeviceDetector $deviceDetectorClass)
    {
        $this->autoPopulateSuperGlobals();
        $clientIp = $this->brServerGlobals->getClientIp();
        return [
            'brand'     => $deviceDetectorClass->getDeviceName(),
            'ip'        => $clientIp,
            'ip direct' => $this->brServerGlobals->server->get('REMOTE_ADDR'),
            'ip type'   => $this->checkIpIsPrivate($clientIp),
            'ip v4/v6'  => $this->checkIpIsV4OrV6($clientIp),
            'model'     => $deviceDetectorClass->getModel(),
            'name'      => $deviceDetectorClass->getBrandName(),
        ];
    }
1140812
public function getDeviceType()
    {
        $device = $this->session->get('device');

        if (empty($device)) {

            $detector = $this->getLibrary();

            if ($detector->isMobile()) {
                $device = 'mobile';
            } else if ($detector->isTablet()) {
                $device = 'tablet';
            } else {
                $device = 'desktop';
            }

            $this->session->set('device', $device);
        }

        return $device;
    }
154065
public static function get_user_device_type() {
        $device = self::get_device_type();
        $switched = get_user_preferences('switchdevice'.$device, false);
        if ($switched != false) {
            return $switched;
        }
        return $device;
    }
1286907
public String[] getDevicesOfClass(final String tangoClass) throws DevFailed {
        if (!tangoClasses.containsKey(tangoClass)) {
            throw DevFailedUtils.newDevFailed(ExceptionMessages.CLASS_NOT_FOUND, tangoClass
                    + " does not exists on this server");
        }
        String[] deviceNames = new String[] {};
        for (final DeviceClassBuilder classBuilder : deviceClassList) {
            if (tangoClass.equalsIgnoreCase(classBuilder.getClassName())) {
                final List<String> list = classBuilder.getDeviceNameList();
                deviceNames = list.toArray(new String[0]);
                break;
            }
        }
        return deviceNames;
    }
244929
public function getDevs()
    {

        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Hardware Devices');
        }

        $devs = array();

        foreach ($this->wmi->ExecQuery('SELECT DeviceID, Caption, Manufacturer FROM Win32_PnPEntity') as $pnpdev) {
            $devId = explode('\\', $pnpdev->DeviceID);
            $type = reset($devId);
            if (($type != 'USB' && $type != 'PCI') || (empty($pnpdev->Caption) || $pnpdev->Manufacturer[0] == '(')) {
                continue;
            }
            $manufacturer = $pnpdev->Manufacturer;
            $caption = $pnpdev->Caption;
            if (function_exists('iconv')) {
                $manufacturer = iconv('Windows-1252', 'UTF-8//TRANSLIT', $manufacturer);
                $caption = iconv('Windows-1252', 'UTF-8//TRANSLIT', $caption);
            }
            $devs[] = array(
                'vendor' => $manufacturer,
                'device' => $caption,
                'type' => $type,
            );
        }

        // Sort by 1. Type, 2. Vendor
        usort($devs, array('Linfo\OS\Windows', 'compare_devices'));

        return $devs;
    }
1319768
private static function deviceParser() {

        // build the obj that will be returned
        $deviceObj = new \stdClass();

        // run the regexes to match things up
        $deviceRegexes = self::$regexes['device_parsers'];
        foreach ($deviceRegexes as $deviceRegex) {
            if (preg_match("/".str_replace("/","\/",$deviceRegex['regex'])."/i",self::$ua,$matches)) {

                // Make sure device matches are null
                // Device Name, Major and Minor defaults
                if (!isset($matches[1])) { $matches[1] = null; }
                    if (!isset($matches[2])) { $matches[2] = null; }
                        if (!isset($matches[3])) { $matches[3] = null; }

                            // basic properties
                            $deviceObj->deviceMajor  = isset($deviceRegex['device_v1_replacement']) ? $deviceRegex['device_v1_replacement'] : $matches[2];
                $deviceObj->deviceMinor  = isset($deviceRegex['device_v2_replacement']) ? $deviceRegex['device_v2_replacement'] : $matches[3];
                $deviceObj->device       = isset($deviceRegex['device_replacement']) ? str_replace("$1",$matches[1],$deviceRegex['device_replacement']) : str_replace("_"," ",$matches[1]);

                // device version?
                $deviceObj->deviceVersion = isset($deviceObj->deviceMajor) ? $deviceObj->deviceMajor : "";
                $deviceObj->deviceVersion = isset($deviceObj->deviceMinor) ? $deviceObj->deviceVersion.'.'.$deviceObj->deviceMinor : $deviceObj->deviceVersion;

                // prettify
                $deviceObj->deviceFull = $deviceObj->device." ".$deviceObj->deviceVersion;

                // check to see if this is a mobile device
                // this isn't really needed because if it matches a mobile browser it'll automatically mark it as a mobile device
                $deviceObj->isMobileDevice = false;
                $mobileDevices  = array("iPhone","iPod","iPad","HTC","Kindle","Lumia","Amoi","Asus","Bird","Dell","DoCoMo","Huawei","i-mate","Kyocera",
                    "Lenovo","LG","Kin","Motorola","Philips","Samsung","Softbank","Palm","HP ","Generic Feature Phone","Generic Smartphone",
                    "Nintendo DSi","Nintendo 3DS","PlayStation Vita");
                foreach($mobileDevices as $mobileDevice) {
                    if (stristr($deviceObj->device, $mobileDevice)) {
                        $deviceObj->isMobileDevice = true;
                        break;
                    }
                }

                // check to see if this is a tablet (not perfect)
                $deviceObj->isTablet = false;
                $tablets = array("Kindle","iPad","Playbook","TouchPad","Dell Streak","Galaxy Tab","Xoom");
                foreach($tablets as $tablet) {
                    if (stristr($deviceObj->device, $tablet)) {
                        $deviceObj->isTablet = true;
                        break;
                    }
                }

                return $deviceObj;
            }
        }
        return false;
    }
448306
protected function magic_get_devicetypeinuse() {
        if (empty($this->_devicetypeinuse)) {
            $this->_devicetypeinuse = core_useragent::get_user_device_type();
        }
        return $this->_devicetypeinuse;
    }
925280
public function getVisitors()
	{
		$remote_addrs	= array();	
		$counter	= 0;
		foreach( $this->data as $entry )
		{
			if( $entry['remote_addr'] != $this->skip )
			{
				if( isset( $remote_addrs[$entry['remote_addr']] ) )
				{
					if( $remote_addrs[$entry['remote_addr']] < $entry['timestamp'] - 30 * 60 )
						$counter ++;
					$remote_addrs[$entry['remote_addr']]	= $entry['timestamp'];
				}
				else
				{
					$counter ++;
					$remote_addrs[$entry['remote_addr']]	= $entry['timestamp'];
				}
			}
		}
		return $counter;
	}
97603
public function getDevs()
    {
        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Hardware Devices');
        }

        // Match them
        if (preg_match_all('/([a-z]+\d+) at ([a-z]+)\d*.+ "(.+)"/m', $this->dmesg, $devices_match, PREG_SET_ORDER) == 0) {
            return [];
        }

        // Store them here
        $devices = [];

        // Stuff them
        foreach ($devices_match as $match) {
            $type = strtoupper($match[2]);

            $devices[] = array(
                'vendor' => false, // hmm
                'device' => $match[3],
                'type' => $type,

            );
        }

        // Give them
        return $devices;
    }
316054
public function getAllDevicesID()
    {
        $devicesId = array();
        foreach ($this->deviceClassificationNames as $className) {
            $currentMap = $this->persistenceStorage->load($className);
            if (!is_array($currentMap)) {
                $currentMap = array();
            }
            $devicesId = array_merge($devicesId, array_values($currentMap));
        }
        return $devicesId;
    }
935780
public function update(array $deviceIdentifier, string $comment)
    {
        $params = [
            'device_identifier' => $deviceIdentifier,
            'comment' => $comment,
        ];

        return $this->httpPostJson('shakearound/device/update', $params);
    }
383352
public Class[] getDeviceInterface()                                    // F177053
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getDeviceInterface");        // F177053

      // Start D232185
      if (devSideInterfaceClasses == null)
      {
         devSideInterfaceClasses = new Class[1];
         devSideInterfaceClasses[0] = com.ibm.wsspi.tcpchannel.TCPConnectionContext.class;   // f167363, F184828, F189000
      }
      // End D232185
      
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getDeviceInterface", devSideInterfaceClasses);        // F177053
      return devSideInterfaceClasses;
   }
963628
public function getAllCapabilitiesForDevice($deviceID)
    {
        $devices      = array_reverse($this->getDeviceHierarchy($deviceID));
        $capabilities = array();

        foreach ($devices as $device) {
            /** @var $device \Wurfl\Device\ModelDeviceInterface */
            if (is_array($device->capabilities)) {
                $capabilities = array_merge($capabilities, $device->capabilities);
            }
        }
        $capabilities = array_diff_key($capabilities, array_flip(VirtualCapabilityProvider::getControlCapabilities()));

        return $capabilities;
    }
1015157
protected function getDevicesFromSessions(Carbon $start, Carbon $end)
    {
        return $this->getVisitorsFilteredByDateRange($start, $end)
            ->filter(function (Visitor $session) {
                return $session->hasDevice();
            })
            ->transform(function (Visitor $session) {
                return $session->device;
            })
            ->groupBy('kind')
            ->transform(function (Collection $items, $key) {
                return [
                    'kind'  => trans("tracker::devices.kinds.$key"),
                    'count' => $items->count(),
                ];
            });
    }
1033283
public function getProviderInstance($providerOrClass)
    {
        if (is_a($providerOrClass, ProviderAbstract::PROVIDER_CLASS, true)) {
            if (!is_object($providerOrClass)) {
                $providerOrClass = new $providerOrClass;
            }
            return $providerOrClass;
        } else {
            throw new LogicException(
                Message::get(Message::EXT_PROVIDER_ERROR, $providerOrClass),
                Message::EXT_PROVIDER_ERROR
            );
        }
    }
175861
public function getNet()
    {

        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Network Devices');
        }

        // Hold our return values
        $return = [];

        // Get values for each device
        foreach ((array) @glob('/sys/class/net/*', GLOB_NOSORT) as $path) {
            $nic = basename($path);

            // States
            $operstate_contents = Common::getContents($path.'/operstate');
            switch ($operstate_contents) {
                case 'down':
                case 'up':
                case 'unknown':
                    $state = $operstate_contents;
                break;

                default:
                    $state = 'unknown';
                break;
            }

            if ($state === 'unknown' && file_exists($path.'/carrier')) {
                $carrier = Common::getContents($path.'/carrier', false);
                if (!empty($carrier)) {
                    $state = 'up';
                } else {
                    $state = 'down';
                }
            }

            // Try the weird ways of getting type (https://stackoverflow.com/a/16060638)
            $type = false;
            $typeCode = Common::getIntFromFile($path.'/type');

            if ($typeCode == 772) {
                $type = 'Loopback';
            } elseif ($typeCode == 65534) {
                $type = 'Tunnel';
            } elseif ($typeCode == 776) {
                $type = 'IPv6 in IPv4';
            }

            if (!$type) {
                $type_contents = strtoupper(Common::getContents($path.'/device/modalias'));
                list($type_match) = explode(':', $type_contents, 2);

                if (in_array($type_match, array('PCI', 'USB'))) {
                    $type = 'Ethernet ('.$type_match.')';

                    // Driver maybe?
                    if (($uevent_contents = @parse_ini_file($path.'/device/uevent')) && isset($uevent_contents['DRIVER'])) {
                        $type .= ' ('.$uevent_contents['DRIVER'].')';
                    }
                } elseif ($type_match == 'VIRTIO') {
                    $type = 'VirtIO';
                } elseif ($type_contents == 'XEN:VIF') {
                    $type = 'Xen (VIF)';
                } elseif ($type_contents == 'XEN-BACKEND:VIF') {
                    $type = 'Xen Backend (VIF)';
                } elseif (is_dir($path.'/bridge')) {
                    $type = 'Bridge';
                } elseif (is_dir($path.'/bonding')) {
                    $type = 'Bond';
                }

                // TODO find some way of finding out what provides the virt-specific kvm vnet devices
            }

            $speed = Common::getIntFromFile($path.'/speed');

            // Save and get info for each
            $return[$nic] = array(

                // Stats are stored in simple files just containing the number
                'recieved' => array(
                    'bytes' => Common::getIntFromFile($path.'/statistics/rx_bytes'),
                    'errors' => Common::getIntFromFile($path.'/statistics/rx_errors'),
                    'packets' => Common::getIntFromFile($path.'/statistics/rx_packets'),
                ),
                'sent' => array(
                    'bytes' => Common::getIntFromFile($path.'/statistics/tx_bytes'),
                    'errors' => Common::getIntFromFile($path.'/statistics/tx_errors'),
                    'packets' => Common::getIntFromFile($path.'/statistics/tx_packets'),
                ),

                // These were determined above
                'state' => $state,
                'type' => $type ?: 'N/A',
                'port_speed' => $speed > 0 ? $speed : false,
            );
        }

        // Return array of info
        return $return;
    }
810681
private function getCurrentDeviceProperties()
    {
        if ($properties = $this->getDeviceDetector()->detect()) {
            $parser = $this->getUserAgentParser();

            $properties['platform']         = $parser->getOperatingSystemFamily();
            $properties['platform_version'] = $parser->getOperatingSystemVersion();
        }

        return $properties;
    }