WhichBrowser\Analyser\Header\Useragent\Device\Television::detectGenericHbbTV PHP Method

detectGenericHbbTV() private method

* HbbTV model information
private detectGenericHbbTV ( $ua )
    private function detectGenericHbbTV($ua)
    {
        if (preg_match('/((HbbTV|OHTV|SmartTV)\\/[0-9\\.]+|CE-HTML)/iu', $ua)) {
            $this->data->device->type = Constants\DeviceType::TELEVISION;
            $vendorName = null;
            $modelName = null;
            $found = false;
            if (preg_match('/HbbTV\\/[0-9\\.]+;CE-HTML\\/[0-9\\.]+;([A-Z]+)\\s([^;]+);/iu', $ua, $match)) {
                $vendorName = Data\Manufacturers::identify(Constants\DeviceType::TELEVISION, $match[1]);
                $modelName = trim($match[2]);
                $found = true;
            }
            if (preg_match('/UID\\([a-f0-9:]+\\/([^\\/]+)\\/([^\\/]+)\\/[0-9a-z\\.]+\\)\\+CE-HTML/iu', $ua, $match)) {
                $vendorName = Data\Manufacturers::identify(Constants\DeviceType::TELEVISION, $match[2]);
                $modelName = trim($match[1]);
                $found = true;
            }
            if (preg_match('/(?:HbbTV|OHTV)\\/[0-9\\.]+ \\(([^;]*);\\s*([^;]*)\\s*;\\s*([^;]*)\\s*;/u', $ua, $match)) {
                if (trim($match[1]) == "" || in_array(strtok($match[1], ' '), ['PVR', 'DL']) || strpos($match[1], '+') !== false) {
                    $vendorName = Data\Manufacturers::identify(Constants\DeviceType::TELEVISION, $match[2]);
                    $modelName = trim($match[3]);
                } else {
                    $vendorName = Data\Manufacturers::identify(Constants\DeviceType::TELEVISION, $match[1]);
                    $modelName = trim($match[2]);
                }
                $found = true;
            }
            if (preg_match('/(?:^|\\s)SmartTV\\/[0-9\\.]+ \\(([^;]*)\\s*;\\s*([^;]*)\\s*;/u', $ua, $match)) {
                $vendorName = Data\Manufacturers::identify(Constants\DeviceType::TELEVISION, $match[1]);
                $modelName = trim($match[2]);
                $found = true;
            }
            if (in_array($vendorName, ['Access', 'ANT', 'EMSYS', 'Em-Sys', 'Opera', 'Opera Software', 'Seraphic', 'Vendor'])) {
                $found = false;
            }
            if ($found) {
                $this->data->device->identified |= Constants\Id::PATTERN;
                switch ($vendorName) {
                    case 'LG':
                        $this->data->device->manufacturer = 'LG';
                        switch ($modelName) {
                            case 'NetCast 3.0':
                            case 'GLOBAL_PLAT3':
                                $this->data->device->series = 'NetCast TV 2012';
                                break;
                            case 'NetCast 4.0':
                            case 'GLOBAL-PLAT4':
                                $this->data->device->series = 'NetCast TV 2013';
                                break;
                            case 'WEBOS3':
                                $this->data->device->series = 'webOS TV';
                                break;
                        }
                        break;
                    case 'Samsung':
                        $this->data->device->manufacturer = 'Samsung';
                        switch ($modelName) {
                            case 'SmartTV2012':
                                $this->data->device->series = 'Smart TV 2012';
                                break;
                            case 'SmartTV2013':
                                $this->data->device->series = 'Smart TV 2013';
                                break;
                            case 'SmartTV2014':
                                $this->data->device->series = 'Smart TV 2014';
                                break;
                            case 'SmartTV2015':
                                $this->data->device->series = 'Smart TV 2015';
                                break;
                            case 'OTV-SMT-E5015':
                                $this->data->device->model = 'Olleh SkyLife Smart Settopbox';
                                unset($this->data->device->series);
                                break;
                        }
                        break;
                    case 'Panasonic':
                        $this->data->device->manufacturer = 'Panasonic';
                        switch ($modelName) {
                            case 'VIERA 2011':
                                $this->data->device->series = 'Viera 2011';
                                break;
                            case 'VIERA 2012':
                                $this->data->device->series = 'Viera 2012';
                                break;
                            case 'VIERA 2013':
                                $this->data->device->series = 'Viera 2013';
                                break;
                            case 'VIERA 2014':
                                $this->data->device->series = 'Viera 2014';
                                break;
                            case 'VIERA 2015':
                            case 'Viera2015.mid':
                                $this->data->device->series = 'Viera 2015';
                                break;
                            default:
                                $this->data->device->model = $modelName;
                                break;
                        }
                        break;
                    case 'TV2N':
                        $this->data->device->manufacturer = 'TV2N';
                        switch ($modelName) {
                            case 'videoweb':
                                $this->data->device->model = 'Videoweb';
                                break;
                        }
                        break;
                    default:
                        if ($vendorName != '' && !in_array($vendorName, ['OEM', 'vendorName'])) {
                            $this->data->device->manufacturer = $vendorName;
                        }
                        if ($modelName != '' && !in_array($modelName, ['dvb', 'modelName', 'undefined-model-name', 'N/A'])) {
                            $this->data->device->model = $modelName;
                        }
                        break;
                }
                switch ($modelName) {
                    case 'hdr1000s':
                        $this->data->device->manufacturer = 'Humax';
                        $this->data->device->model = 'HDR-1000S';
                        $this->data->device->identified |= Constants\Id::MATCH_UA;
                        $this->data->device->generic = false;
                        break;
                    case 'hdr4000t':
                        $this->data->device->manufacturer = 'Humax';
                        $this->data->device->model = 'HDR-4000T';
                        $this->data->device->identified |= Constants\Id::MATCH_UA;
                        $this->data->device->generic = false;
                        break;
                    case 'hgs1000s':
                        $this->data->device->manufacturer = 'Humax';
                        $this->data->device->model = 'HGS-1000S';
                        $this->data->device->identified |= Constants\Id::MATCH_UA;
                        $this->data->device->generic = false;
                        break;
                    case 'hms1000s':
                    case 'hms1000sph2':
                        $this->data->device->manufacturer = 'Humax';
                        $this->data->device->model = 'HMS-1000S';
                        $this->data->device->identified |= Constants\Id::MATCH_UA;
                        $this->data->device->generic = false;
                        break;
                }
            }
        }
        if (preg_match('/HbbTV\\/[0-9.]+;CE-HTML\\/[0-9.]+;([^\\s;]+)\\s[^\\s;]+;/u', $ua, $match)) {
            $this->data->device->manufacturer = Data\Manufacturers::identify(Constants\DeviceType::TELEVISION, $match[1]);
            if (!isset($this->data->device->series)) {
                $this->data->device->series = 'Smart TV';
            }
        }
        if (preg_match('/HbbTV\\/[0-9.]+;CE-HTML\\/[0-9.]+;Vendor\\/([^\\s;]+);/u', $ua, $match)) {
            $this->data->device->manufacturer = Data\Manufacturers::identify(Constants\DeviceType::TELEVISION, $match[1]);
            if (!isset($this->data->device->series)) {
                $this->data->device->series = 'Smart TV';
            }
        }
    }