@@ -298,7 +298,7 @@ |
||
| 298 | 298 | if (in_array($type, |
| 299 | 299 | [self::BINN_INT64, self::BINN_INT32, self::BINN_INT16, |
| 300 | 300 | self::BINN_UINT64,self::BINN_UINT32, self::BINN_UINT16]) |
| 301 | - ) { |
|
| 301 | + ) { |
|
| 302 | 302 | $type = $this->compress_int($type, $value); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | const BINN_BOOL = 0x80061; |
| 54 | 54 | |
| 55 | 55 | const BINN_STORAGE_NOBYTES = 0x00; |
| 56 | - const BINN_STORAGE_BYTE = 0x20; // 8 bits |
|
| 57 | - const BINN_STORAGE_WORD = 0x40; // 16 bits -- the endianess (byte order) is automatically corrected |
|
| 58 | - const BINN_STORAGE_DWORD = 0x60; // 32 bits -- the endianess (byte order) is automatically corrected |
|
| 59 | - const BINN_STORAGE_QWORD = 0x80; // 64 bits -- the endianess (byte order) is automatically corrected |
|
| 60 | - const BINN_STORAGE_STRING = 0xA0; // Are stored with null termination |
|
| 56 | + const BINN_STORAGE_BYTE = 0x20; // 8 bits |
|
| 57 | + const BINN_STORAGE_WORD = 0x40; // 16 bits -- the endianess (byte order) is automatically corrected |
|
| 58 | + const BINN_STORAGE_DWORD = 0x60; // 32 bits -- the endianess (byte order) is automatically corrected |
|
| 59 | + const BINN_STORAGE_QWORD = 0x80; // 64 bits -- the endianess (byte order) is automatically corrected |
|
| 60 | + const BINN_STORAGE_STRING = 0xA0; // Are stored with null termination |
|
| 61 | 61 | const BINN_STORAGE_BLOB = 0xC0; |
| 62 | 62 | const BINN_STORAGE_CONTAINER = 0xE0; |
| 63 | 63 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @var int |
| 120 | 120 | * @access protected |
| 121 | 121 | */ |
| 122 | - protected $count = 0; |
|
| 122 | + protected $count = 0; |
|
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * Data size in bytes |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | * @var int |
| 128 | 128 | * @access protected |
| 129 | 129 | */ |
| 130 | - protected $data_size = 0; |
|
| 130 | + protected $data_size = 0; |
|
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * Meta size in bytes |
| 134 | 134 | * |
| 135 | 135 | * @var int |
| 136 | 136 | */ |
| 137 | - protected $meta_size = self::MIN_BINN_SIZE; |
|
| 137 | + protected $meta_size = self::MIN_BINN_SIZE; |
|
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * Size bin string in bytes |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @var int |
| 143 | 143 | * @access protected |
| 144 | 144 | */ |
| 145 | - protected $size = 0; |
|
| 145 | + protected $size = 0; |
|
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | 148 | * Bin string |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @var string |
| 151 | 151 | * @access protected |
| 152 | 152 | */ |
| 153 | - protected $binn_string = ""; |
|
| 153 | + protected $binn_string = ""; |
|
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * Object elements |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | { |
| 298 | 298 | if (in_array($type, |
| 299 | 299 | [self::BINN_INT64, self::BINN_INT32, self::BINN_INT16, |
| 300 | - self::BINN_UINT64,self::BINN_UINT32, self::BINN_UINT16]) |
|
| 300 | + self::BINN_UINT64, self::BINN_UINT32, self::BINN_UINT16]) |
|
| 301 | 301 | ) { |
| 302 | 302 | $type = $this->compress_int($type, $value); |
| 303 | 303 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | // Size |
| 562 | 562 | if ($size_bytes & 1 << 7) { |
| 563 | 563 | $size_bytes = unpack("N", substr($binstring, $pos, 4))[1]; |
| 564 | - $this->size = ($size_bytes &~ (1 << 31)); // Cut bit |
|
| 564 | + $this->size = ($size_bytes & ~ (1 << 31)); // Cut bit |
|
| 565 | 565 | $pos += 4; |
| 566 | 566 | } else { |
| 567 | 567 | $this->size = $size_bytes; |
@@ -574,8 +574,8 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | // Size |
| 576 | 576 | if ($count_bytes & 1 << 7) { |
| 577 | - $count_bytes = unpack("N", substr($binstring,$pos, 4))[1]; |
|
| 578 | - $this->count = ($count_bytes &~ (1 << 31)); // Cut bit |
|
| 577 | + $count_bytes = unpack("N", substr($binstring, $pos, 4))[1]; |
|
| 578 | + $this->count = ($count_bytes & ~ (1 << 31)); // Cut bit |
|
| 579 | 579 | $pos += 4; |
| 580 | 580 | } else { |
| 581 | 581 | $this->count = $count_bytes; |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | // Size |
| 649 | 649 | if ($string_size & 1 << 7) { |
| 650 | 650 | $string_size = unpack("N", substr($binstring, $pos, 4))[1]; |
| 651 | - $string_size = ($string_size &~ (1 << 31)); // Cut bit |
|
| 651 | + $string_size = ($string_size & ~ (1 << 31)); // Cut bit |
|
| 652 | 652 | $pos += 4; |
| 653 | 653 | } else { |
| 654 | 654 | $pos += 1; |
@@ -665,13 +665,13 @@ discard block |
||
| 665 | 665 | // Size |
| 666 | 666 | if ($list_size & 1 << 7) { |
| 667 | 667 | $list_size = unpack("N", substr($binstring, $pos, 4))[1]; |
| 668 | - $list_size = ($list_size &~ (1 << 31)); // Cut bit |
|
| 668 | + $list_size = ($list_size & ~ (1 << 31)); // Cut bit |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - $substring = substr($binstring, $pos-1, $list_size); |
|
| 671 | + $substring = substr($binstring, $pos - 1, $list_size); |
|
| 672 | 672 | $this->_add_val(self::BINN_LIST, new Binn($substring)); |
| 673 | 673 | |
| 674 | - $pos += ($list_size-1); |
|
| 674 | + $pos += ($list_size - 1); |
|
| 675 | 675 | |
| 676 | 676 | break; |
| 677 | 677 | |
@@ -205,11 +205,9 @@ discard block |
||
| 205 | 205 | // Signed |
| 206 | 206 | if ($val >= self::INT8_MIN) { |
| 207 | 207 | $type2 = self::BINN_INT8; |
| 208 | - } |
|
| 209 | - elseif ($val >= self::INT16_MIN) { |
|
| 208 | + } elseif ($val >= self::INT16_MIN) { |
|
| 210 | 209 | $type2 = self::BINN_INT16; |
| 211 | - } |
|
| 212 | - elseif ($val >= self::INT32_MIN) { |
|
| 210 | + } elseif ($val >= self::INT32_MIN) { |
|
| 213 | 211 | $type2 = self::BINN_INT32; |
| 214 | 212 | } |
| 215 | 213 | } |
@@ -219,11 +217,9 @@ discard block |
||
| 219 | 217 | |
| 220 | 218 | if ($val <= self::UINT8_MAX) { |
| 221 | 219 | $type2 = self::BINN_UINT8; |
| 222 | - } |
|
| 223 | - elseif ($val <= self::UINT16_MAX) { |
|
| 220 | + } elseif ($val <= self::UINT16_MAX) { |
|
| 224 | 221 | $type2 = self::BINN_UINT16; |
| 225 | - } |
|
| 226 | - elseif ($val <= self::UINT32_MAX) { |
|
| 222 | + } elseif ($val <= self::UINT32_MAX) { |
|
| 227 | 223 | $type2 = self::BINN_UINT32; |
| 228 | 224 | } |
| 229 | 225 | } |