Parser/ParserAbstract.php
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);
    }
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);
    }
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 ) ; }
Tests the useragent against a combination of all regexes

All regexes returned by getRegexes() will be reversed and concated with '|'
Afterwards the big regex will be tested against the user agent

Method can be used to speed up detections by making a big check before doing checks for every single regex

@return bool
Tests the useragent against a combination of all regexes