You are here

private function RateBotDetector::isLocal in Rate 8

Check if the given IP is a local IP-address.

Return value

bool True if local IP; false otherwise.

1 call to RateBotDetector::isLocal()
RateBotDetector::checkIsBot in src/RateBotDetector.php
Check if the current user is blocked.

File

src/RateBotDetector.php, line 88

Class

RateBotDetector
The rate.bot_detector service.

Namespace

Drupal\rate

Code

private function isLocal() {
  if (preg_match('/^([012]?[0-9]{2})\\./', $this->ip, $match)) {
    switch ($match[1]) {
      case 10:
      case 127:
      case 172:
      case 192:
        return TRUE;
    }
  }
  return FALSE;
}