You are here

public function IpRanges::getIpDisplay in IP Ranges 8

Returns lower and higher IP concatenated as a string.

If IPs are the same, return only lower value.

Return value

string IP List.

File

lib/Drupal/ip_ranges/Entity/IpRanges.php, line 60

Class

IpRanges
Defines a Block configuration entity class.

Namespace

Drupal\ip_ranges\Entity

Code

public function getIpDisplay() {
  if ($this
    ->getIpLower() != $this
    ->getIpHigher()) {
    $ip_list = long2ip($this
      ->getIpLower()) . '-' . long2ip($this
      ->getIpHigher());
  }
  else {
    $ip_list = long2ip($this
      ->getIpLower());
  }
  return $ip_list;
}