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.

Returns

true|false.

Usage

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

MobileDetect::matchDetectionRulesAgainstUA() code WC 9.8.5

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;
}