You are here

protected function RestrictIpService::ip2CountryGetCurrentUserCountry in Restrict IP 8.2

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

Get the current user's country

Return value

string The two-letter country code for the given IP address

2 calls to RestrictIpService::ip2CountryGetCurrentUserCountry()
RestrictIpService::allowAccessBlacklistCountry in src/Service/RestrictIpService.php
* Test to see if the current user is blacklist based on their country
RestrictIpService::allowAccessWhitelistCountry in src/Service/RestrictIpService.php
* Test to see if the current user is whitelisted based on their country

File

src/Service/RestrictIpService.php, line 281

Class

RestrictIpService

Namespace

Drupal\restrict_ip\Service

Code

protected function ip2CountryGetCurrentUserCountry() {
  return ip2country_get_country($this->currentUserIp);
}