You are here

public function RestrictIpService::__construct in Restrict IP 8

Same name and namespace in other branches
  1. 8.2 src/Service/RestrictIpService.php \Drupal\restrict_ip\Service\RestrictIpService::__construct()
  2. 3.x src/Service/RestrictIpService.php \Drupal\restrict_ip\Service\RestrictIpService::__construct()

* Constructs a RestrictIpService object * *

Parameters

\Drupal\Core\Session\AccountProxyInterface $currentUser: * The current user * @param \Drupal\Core\Path\CurrentPathStack $currentPathStack * The current path stack * @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory * The Config Factory service * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack * The current HTTP request * @param \Drupal\restrict_ip\Mapper\RestrictIpMapperInterface $restrictIpMapper * The Restrict IP data mapper object * @param \Drupal\Core\Path\PathMatcherInterface $pathMatcher * The Path Matcher service

File

src/Service/RestrictIpService.php, line 79

Class

RestrictIpService

Namespace

Drupal\restrict_ip\Service

Code

public function __construct(AccountProxyInterface $currentUser, CurrentPathStack $currentPathStack, ConfigFactoryInterface $configFactory, RequestStack $requestStack, RestrictIpMapperInterface $restrictIpMapper, PathMatcherInterface $pathMatcher) {
  $this->currentUser = $currentUser;
  $this->mapper = $restrictIpMapper;
  $this->pathMatcher = $pathMatcher;
  $this->currentPath = strtolower($currentPathStack
    ->getPath());
  $this->config = $configFactory
    ->get('restrict_ip.settings');
  $this->currentUserIp = $requestStack
    ->getCurrentRequest()
    ->getClientIp();
}