public function isCrawler($userAgent = null)
{
$agent = $userAgent ?: $this->userAgent;
$agent = preg_replace('/' . $this->getExclusions() . '/i', '', $agent);
if (strlen(trim($agent)) == 0) {
return false;
}
$result = preg_match('/' . $this->getRegex() . '/i', trim($agent), $matches);
if ($matches) {
$this->matches = $matches;
}
return (bool) $result;
}