You are here

public function RateBotDetector::__construct in Rate 8.2

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.

\Drupal\Component\Datetime\TimeInterface $time: The time service.

File

src/Plugin/RateBotDetector.php, line 84

Class

RateBotDetector
The rate.bot_detector service.

Namespace

Drupal\rate\Plugin

Code

public function __construct(ConfigFactoryInterface $config_factory, Connection $database, Client $http_client, RequestStack $request_stack, TimeInterface $time) {
  $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');
  $this->time = $time;
}