Automattic\WooCommerce\Vendor\Detection

MobileDetect::matchDetectionRulesAgainstUA()protectedWC 1.0

Find a detection rule that matches the current User-agent.

Method of the class: MobileDetect{}

No Hooks.

Return

true|false.

Usage

// protected - for code of main (parent) or child class
$result = $this->matchDetectionRulesAgainstUA( $userAgent ): bool;
$userAgent(string|null)
deprecated
Default: null

MobileDetect::matchDetectionRulesAgainstUA() code WC 8.9.0

protected function matchDetectionRulesAgainstUA(string $userAgent = null): bool
{
    // Begin general search.
    foreach ($this->getRules() as $_regex) {
        if (empty($_regex)) {
            continue;
        }

        if ($this->match($_regex, $userAgent)) {
            return true;
        }
    }

    return false;
}