| @@ 97-104 (lines=8) @@ | ||
| 94 | /** |
|
| 95 | * IPv4 only. |
|
| 96 | */ |
|
| 97 | public function getNetmask() |
|
| 98 | { |
|
| 99 | if (4 !== $this->getFamily()) { |
|
| 100 | throw new IPException('method only for IPv4'); |
|
| 101 | } |
|
| 102 | ||
| 103 | return long2ip(-1 << (32 - $this->getPrefix())); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * IPv4 only. |
|
| @@ 121-128 (lines=8) @@ | ||
| 118 | /** |
|
| 119 | * IPv4 only. |
|
| 120 | */ |
|
| 121 | public function getNumberOfHosts() |
|
| 122 | { |
|
| 123 | if (4 !== $this->getFamily()) { |
|
| 124 | throw new IPException('method only for IPv4'); |
|
| 125 | } |
|
| 126 | ||
| 127 | return pow(2, 32 - $this->getPrefix()) - 2; |
|
| 128 | } |
|
| 129 | ||
| 130 | public function split($networkCount) |
|
| 131 | { |
|