Вход Регистрация
Файл: vendor/whichbrowser/parser/src/Analyser/Header/OperaMini.php
Строк: 56
<?php

namespace WhichBrowserAnalyserHeader;

use 
WhichBrowserData;
use 
WhichBrowserConstants;

class 
OperaMini
{
    public function 
__construct($header, &$data)
    {
        
$this->data =& $data;

        
$parts = explode(' # ', $header);
        
$manufacturer = isset($parts[0]) ? $parts[0] : '';
        
$model = isset($parts[1]) ? $parts[1] : '';

        if (
$manufacturer != '?' && $model != '?') {
            if (
$this->data->device->identified < ConstantsId::PATTERN) {
                if (
$this->identifyBasedOnModel($model)) {
                    return;
                }

                
$this->data->device->manufacturer = $manufacturer;
                
$this->data->device->model = $model;
                
$this->data->device->identified = true;
            }
        }
    }

    private function 
identifyBasedOnModel($model)
    {
        
$device = DataDeviceModels::identify('bada', $model);
        if (
$device->identified) {
            
$device->identified |= $this->data->device->identified;
            
$this->data->device = $device;

            if (!isset(
$this->data->os->name) || $this->data->os->name != 'Bada') {
                
$this->data->os->name = 'Bada';
                
$this->data->os->version = null;
            }

            return 
true;
        }

        
$device = DataDeviceModels::identify('blackberry', $model);
        if (
$device->identified) {
            
$device->identified |= $this->data->device->identified;
            
$this->data->device = $device;

            if (!isset(
$this->data->os->name) || $this->data->os->name != 'BlackBerry OS') {
                
$this->data->os->name = 'BlackBerry OS';
                
$this->data->os->version = null;
            }

            return 
true;
        }

        
$device = DataDeviceModels::identify('wm', $model);
        if (
$device->identified) {
            
$device->identified |= $this->data->device->identified;
            
$this->data->device = $device;

            if (!isset(
$this->data->os->name) || $this->data->os->name != 'Windows Mobile') {
                
$this->data->os->name = 'Windows Mobile';
                
$this->data->os->version = null;
            }

            return 
true;
        }
    }
}
Онлайн: 2
Реклама