Automattic\WooCommerce\Vendor\Detection
MobileDetect::is
This method checks for a certain property in the userAgent.
Method of the class: MobileDetect{}
No Hooks.
Returns
true|false.
Usage
$MobileDetect = new MobileDetect(); $MobileDetect->is( $key, ?string $userAgent, ?array $httpHeaders ): bool;
- $key(string) (required)
- .
- ?string $userAgent
- .
Default:null - ?array $httpHeaders
- .
Default:null
MobileDetect::is() MobileDetect::is code WC 10.9.1
public function is(string $key, ?string $userAgent = null, ?array $httpHeaders = null): bool
{
// Set the UA and HTTP headers only if needed (eg. batch mode).
if ($httpHeaders) {
$this->setHttpHeaders($httpHeaders);
}
if ($userAgent) {
$this->setUserAgent($userAgent);
}
return $this->matchUAAgainstKey($key);
}