@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | foreach (array('get', 'to') as $prefix) { |
19 | - $method = $prefix . ucfirst($name); |
|
19 | + $method = $prefix.ucfirst($name); |
|
20 | 20 | if (method_exists($this, $method)) { |
21 | 21 | return $this->$method(); |
22 | 22 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function __set($name, $value) |
34 | 34 | { |
35 | - $method = 'set' . ucfirst($name); |
|
35 | + $method = 'set'.ucfirst($name); |
|
36 | 36 | if (method_exists($this, $method)) { |
37 | 37 | $this->$method($value); |
38 | 38 | return; |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | |
76 | 76 | if ($this->ip->getVersion() === IPv4::version) { |
77 | 77 | if ($this->getBlockSize() > 2) { |
78 | - $firstHost = IP::parseBin(substr($firstHost->toBin(), 0, $firstHost->getMaxPrefixLength() - 1) . '1'); |
|
79 | - $lastHost = IP::parseBin(substr($lastHost->toBin(), 0, $lastHost->getMaxPrefixLength() - 1) . '0'); |
|
78 | + $firstHost = IP::parseBin(substr($firstHost->toBin(), 0, $firstHost->getMaxPrefixLength() - 1).'1'); |
|
79 | + $lastHost = IP::parseBin(substr($lastHost->toBin(), 0, $lastHost->getMaxPrefixLength() - 1).'0'); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $prefixLength = $this->getPrefixLength(); |
128 | 128 | |
129 | 129 | if ($this->ip->getVersion() === IP::v6) { |
130 | - return bcpow('2', (string)($maxPrefixLength - $prefixLength)); |
|
130 | + return bcpow('2', (string) ($maxPrefixLength - $prefixLength)); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return pow(2, $maxPrefixLength - $prefixLength); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | { |
209 | 209 | if (preg_match('~^(.+?)/(\d+)$~', $data, $matches)) { |
210 | 210 | $ip = IP::parse($matches[1]); |
211 | - $netmask = self::prefix2netmask((int)$matches[2], $ip->getVersion()); |
|
211 | + $netmask = self::prefix2netmask((int) $matches[2], $ip->getVersion()); |
|
212 | 212 | } elseif (strpos($data, ' ')) { |
213 | 213 | list($ip, $netmask) = explode(' ', $data, 2); |
214 | 214 | $ip = IP::parse($ip); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | throw new \Exception('Invalid prefix length'); |
244 | 244 | } |
245 | 245 | |
246 | - $binIP = str_pad(str_pad('', (int)$prefixLength, '1'), $maxPrefixLength, '0'); |
|
246 | + $binIP = str_pad(str_pad('', (int) $prefixLength, '1'), $maxPrefixLength, '0'); |
|
247 | 247 | |
248 | 248 | return IP::parseBin($binIP); |
249 | 249 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | public function setPrefixLength($prefixLength) |
269 | 269 | { |
270 | - $this->setNetmask(self::prefix2netmask((int)$prefixLength, $this->ip->getVersion())); |
|
270 | + $this->setNetmask(self::prefix2netmask((int) $prefixLength, $this->ip->getVersion())); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function count() |
340 | 340 | { |
341 | - return (integer)$this->getBlockSize(); |
|
341 | + return (integer) $this->getBlockSize(); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | } |