Skip to content
Snippets Groups Projects
Commit f1a8a4df authored by Stephen Mustgrave's avatar Stephen Mustgrave
Browse files

Merge branch '3495439-round2' into '5.0.x'

Draft: Resolve #3495439 "Round2"

See merge request !27
parents a9c72085 34b3acd6
No related branches found
No related tags found
No related merge requests found
Pipeline #377981 failed
......@@ -71,20 +71,20 @@ class RestrictIpService implements RestrictIpServiceInterface, ContainerInjectio
* The Path Matcher service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* The Module Handler service.
* @param \Drupal\user\UserDataInterface $userData
* @param \Drupal\user\UserDataInterface|null $userData
* The User Data service.
* @param \Drupal\ip2country\Ip2CountryLookup|null $ip2CountryLookupService
* An ip2CountryLookupService object.
*/
public function __construct(
protected AccountProxyInterface $currentUser,
CurrentPathStack $currentPathStack,
protected CurrentPathStack $currentPathStack,
protected ConfigFactoryInterface $configFactory,
protected RequestStack $requestStack,
protected RestrictIpMapperInterface $mapper,
protected PathMatcherInterface $pathMatcher,
protected ModuleHandlerInterface $moduleHandler,
protected UserDataInterface $userData,
protected ?UserDataInterface $userData = NULL,
?Ip2CountryLookup $ip2CountryLookupService = NULL,
) {
$this->currentPath = strtolower($currentPathStack->getPath());
......@@ -97,16 +97,21 @@ class RestrictIpService implements RestrictIpServiceInterface, ContainerInjectio
* {@inheritDoc}
*/
public static function create(ContainerInterface $container): static {
$ip2CountryLookupService = NULL;
if ($container->has('ip2country.lookup')) {
$ip2CountryLookupService = $container->get('ip2country.lookup');
}
return new static(
$container->get('current_user'),
$container->get('path.current'),
$container->get('config.factory'),
$container->get('request_stack'),
$container->get('restrict_ip.mapper'),
$container->get('path.matcher'),
$container->get('module_handler'),
$container->get('user.data'),
$container->get('path.current'),
$container->get('config.factory'),
$container->get('request_stack'),
$container->get('ip2country.lookup'),
$ip2CountryLookupService
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment