Automattic\WooCommerce\Vendor\Detection

MobileDetect::matchUAAgainstKeyprotectedWC 1.0

Search for a certain key in the rules array. If the key is found then try to match the corresponding regex against the User-Agent.

Метод класса: MobileDetect{}

Хуков нет.

Возвращает

true|false.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->matchUAAgainstKey( $key ): bool;
$key(строка) (обязательный)
.

Код MobileDetect::matchUAAgainstKey() WC 10.4.3

protected function matchUAAgainstKey(string $key): bool
{
    // Make the keys lowercase, so we can match: isIphone(), isiPhone(), isiphone(), etc.
    $key = strtolower($key);
    if (false === isset($this->cache[$key])) {
        // change the keys to lower case
        $_rules = array_change_key_case($this->getRules());

        if (false === empty($_rules[$key])) {
            $this->cache[$key] = $this->match($_rules[$key]);
        }

        if (false === isset($this->cache[$key])) {
            $this->cache[$key] = false;
        }
    }

    return $this->cache[$key];
}