| Server IP : 213.186.33.4 / Your IP : 216.73.216.193 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/a/w/e/awebpaca/piwik/vendor/matomo/device-detector/Parser/Client/Browser/ |
Upload File : |
<?php declare(strict_types=1);
/**
* Device Detector - The Universal Device Detection library for parsing User Agents
*
* @link https://matomo.org
*
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
*/
namespace DeviceDetector\Parser\Client\Browser;
use DeviceDetector\Parser\Client\AbstractClientParser;
/**
* Class Engine
*
* Client parser for browser engine detection
*/
class Engine extends AbstractClientParser
{
/**
* @var string
*/
protected $fixtureFile = 'regexes/client/browser_engine.yml';
/**
* @var string
*/
protected $parserName = 'browserengine';
/**
* Known browser engines mapped to their internal short codes
*
* @var array
*/
protected static $availableEngines = [
'WebKit',
'Blink',
'Trident',
'Text-based',
'Dillo',
'iCab',
'Elektra',
'Presto',
'Gecko',
'KHTML',
'NetFront',
'Edge',
'NetSurf',
'Servo',
'Goanna',
];
/**
* Returns list of all available browser engines
* @return array
*/
public static function getAvailableEngines(): array
{
return self::$availableEngines;
}
/**
* @inheritdoc
*/
public function parse(): ?array
{
$matches = false;
foreach ($this->getRegexes() as $regex) {
$matches = $this->matchUserAgent($regex['regex']);
if ($matches) {
break;
}
}
if (empty($matches) || empty($regex)) {
return null;
}
$name = $this->buildByMatch($regex['name'], $matches);
foreach (self::getAvailableEngines() as $engineName) {
if (\strtolower($name) === \strtolower($engineName)) {
return ['engine' => $engineName];
}
}
// This Exception should never be thrown. If so a defined browser name is missing in $availableEngines
throw new \Exception(\sprintf(
'Detected browser engine was not found in $availableEngines. Tried to parse user agent: %s',
$this->userAgent
)); // @codeCoverageIgnore
}
}