protected function preMatchOverall()
{
$regexes = $this->getRegexes();
static $overAllMatch;
$cacheKey = $this->parserName . DeviceDetector::VERSION . '-all';
$cacheKey = preg_replace('/([^a-z0-9_-]+)/i', '', $cacheKey);
if (empty($overAllMatch)) {
$overAllMatch = $this->getCache()->fetch($cacheKey);
}
if (empty($overAllMatch)) {
// reverse all regexes, so we have the generic one first, which already matches most patterns
$overAllMatch = array_reduce(array_reverse($regexes), function ($val1, $val2) {
if (!empty($val1)) {
return $val1 . '|' . $val2['regex'];
} else {
return $val2['regex'];
}
});
$this->getCache()->save($cacheKey, $overAllMatch);
}
return $this->matchUserAgent($overAllMatch);
}