vendor/piwik/device-detector/Parser/Client/Browser/Engine/Version.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

/**
 * Device Detector - The Universal Device Detection library for parsing User Agents
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
 */
namespace DeviceDetector\Parser\Client\Browser\Engine;

use DeviceDetector\Parser\Client\ClientParserAbstract;

/**
 * Class Version
 *
 * Client parser for browser engine version detection
 *
 * @package DeviceDetector\Parser\Client\Browser\Engine
 */
class Version extends ClientParserAbstract
{
    /**
     * @var string
     */
    private $engine;

    /**
     * Version constructor.
     *
     * @param string $ua
     * @param string $engine
     */
    public function __construct($ua, $engine)
    {
        parent::__construct($ua);

        $this->engine = $engine;
    }

    public function parse()
    {
        if (empty($this->engine)) {
            return '';
        }

        preg_match("~$this->engine\s*/?\s*((?(?=\d+\.\d)\d+[.\d]*|\d{1,7}(?=(?:\D|$))))~i", $this->userAgent, $matches);

        if (!$matches) {
            return '';
        }

        return array_pop($matches);
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。