@@ -38,22 +38,22 @@ discard block |
||
| 38 | 38 | public function __construct(int $netmask) |
| 39 | 39 | { |
| 40 | 40 | parent::__construct($netmask); |
| 41 | - if (0==$netmask) |
|
| 41 | + if(0==$netmask) |
|
| 42 | 42 | { |
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | // Netamsk validation |
| 46 | 46 | $mask = 0xffffffff; |
| 47 | 47 | do { |
| 48 | - if ($mask == $netmask) |
|
| 48 | + if($mask==$netmask) |
|
| 49 | 49 | { |
| 50 | 50 | // valid netmask |
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | $mask = ($mask << 1) & 0xffffffff; |
| 54 | - } while ($mask>0); |
|
| 54 | + } while($mask>0); |
|
| 55 | 55 | |
| 56 | - if ($netmask!=0) |
|
| 56 | + if($netmask!=0) |
|
| 57 | 57 | { |
| 58 | 58 | throw new DomainException(sprintf("Cannot convert 0x%x (%s) to netmask", $netmask, (string)$this)); |
| 59 | 59 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public static function fromCidr(int $cidr) |
| 76 | 76 | { |
| 77 | - if ($cidr<0 || $cidr>32 ) |
|
| 77 | + if($cidr<0 || $cidr>32) |
|
| 78 | 78 | { |
| 79 | 79 | throw new OutOfBoundsException(sprintf("Invalid CIDR value %d", $cidr)); |
| 80 | 80 | } |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | public function asCidr() |
| 105 | 105 | { |
| 106 | 106 | // Pas très élégant.... |
| 107 | - for ($cidr=32 ; $cidr>=0 ; $cidr--) |
|
| 107 | + for($cidr = 32; $cidr>=0; $cidr--) |
|
| 108 | 108 | { |
| 109 | 109 | $n = (0xffffffff << (32 - $cidr)) & 0xffffffff; |
| 110 | - if( $n == $this->int() ) |
|
| 110 | + if($n==$this->int()) |
|
| 111 | 111 | { |
| 112 | 112 | return $cidr; |
| 113 | 113 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function count() |
| 123 | 123 | { |
| 124 | - return (~($this->int()) & 0xffffffff)+1; |
|
| 124 | + return (~($this->int()) & 0xffffffff) + 1; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |