getRegexes() as $regex) { $matches = $this->matchUserAgent($regex['regex']); if ($matches) { break; } } if (empty($matches) || empty($regex)) { return null; } $name = $this->buildByMatch($regex['name'], $matches); foreach (self::getAvailableEngines() as $engineName) { if (\strtolower($name) === \strtolower($engineName)) { return ['engine' => $engineName]; } } // This Exception should never be thrown. If so a defined browser name is missing in $availableEngines throw new \Exception(\sprintf( 'Detected browser engine was not found in $availableEngines. Tried to parse user agent: %s', $this->userAgent )); // @codeCoverageIgnore } }