Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mautic.corals.io/vendor/matomo/device-detector/Parser/Client/Browser/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/vendor/matomo/device-detector/Parser/Client/Browser/Engine.php
<?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',
        'EkiohFlow',
    ];

    /**
     * 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
    }
}

Spamworldpro Mini