public function RateBotDetector::__construct in Rate 8
RateBotDetector constructor.
Parameters
\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The configuration factory.
\Drupal\Core\Database\Connection $database: Database connection object.
\GuzzleHttp\Client $http_client: Http client object.
\Symfony\Component\HttpFoundation\RequestStack $request_stack: Database connection object.
File
- src/
RateBotDetector.php, line 74
Class
- RateBotDetector
- The rate.bot_detector service.
Namespace
Drupal\rateCode
public function __construct(ConfigFactoryInterface $config_factory, Connection $database, Client $http_client, RequestStack $request_stack) {
$this->config = $config_factory
->get('rate.settings');
$this->database = $database;
$this->httpClient = $http_client;
$this->ip = $request_stack
->getCurrentRequest()
->getClientIp();
$this->agent = $request_stack
->getCurrentRequest()->headers
->get('User-Agent');
}