You are here

public function IpAddress::__construct in IP address fields 8

Same name and namespace in other branches
  1. 2.0.x src/IpAddress.php \Drupal\field_ipaddress\IpAddress::__construct()

On construction, parse the given value.

File

src/IpAddress.php, line 54

Class

IpAddress
IpTools class.

Namespace

Drupal\field_ipaddress

Code

public function __construct($value) {
  $this->raw = $value;
  $result = $this
    ->parse($value);
  if ($result === FALSE) {
    $this->family = NULL;
    $this->type = NULL;
    $this->start = NULL;
    $this->end = NULL;
    throw new \Exception('Invalid value.');
  }
}