/** * {@inheritdoc} */ public function checkVisitor(Visitor $visitor) { if ($this->blacklist->match($visitor->getIP())) { return CheckInterface::RESULT_BLOCK; } $uastring = $visitor->getUserAgent()->getUserAgentString(); if ($this->untrustedUserAgents->match($uastring)) { return CheckInterface::RESULT_BLOCK; } return CheckInterface::RESULT_OKAY; }
/** * Checks if the visitor is whitelisted. * * @param \FlameCore\Gatekeeper\Visitor $visitor The visitor * @return bool */ protected function isWhitelisted(Visitor $visitor) { if ($this->whitelist->match($visitor->getIP())) { return true; } $uastring = $visitor->getUserAgent()->getUserAgentString(); if ($this->trustedUserAgents->match($uastring)) { return true; } return false; }