Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
19 | 1 | public function setData($data) |
|
20 | { |
||
21 | 1 | if (! is_string($data)) |
|
22 | 1 | throw new InvalidParameterException(__CLASS__ . ' data must be a string representation of an IP Address: ' . $data . ' in ' . $this->name ); |
|
23 | |||
24 | 1 | $this->data = inet_pton($data); |
|
25 | |||
26 | 1 | if ($this->data === false) |
|
27 | 1 | throw new InvalidParameterException(__CLASS__ . ' your string did not decode properly '); |
|
28 | |||
29 | 1 | return $this; |
|
30 | } |
||
31 | |||
40 |