@@ -65,18 +65,18 @@ discard block |
||
| 65 | 65 | class TBitHelper |
| 66 | 66 | { |
| 67 | 67 | // Defined constants for 32 bit computation |
| 68 | - public const PHP_INT32_MIN = -2147483648; // 0x80000000 |
|
| 69 | - public const PHP_INT32_MAX = 2147483647; // 0x7FFFFFFF |
|
| 68 | + public const PHP_INT32_MIN = -2147483648; // 0x80000000 |
|
| 69 | + public const PHP_INT32_MAX = 2147483647; // 0x7FFFFFFF |
|
| 70 | 70 | // on 32 bit systems the PHP_INT64_UMAX is a float and not a integer. |
| 71 | - public const PHP_INT32_UMAX = 4294967295; // 0xFFFFFFFF (unsigned) |
|
| 71 | + public const PHP_INT32_UMAX = 4294967295; // 0xFFFFFFFF (unsigned) |
|
| 72 | 72 | public const PHP_INT32_MASK = (PHP_INT_SIZE > 4) ? self::PHP_INT32_UMAX : -1; |
| 73 | 73 | |
| 74 | 74 | // Defined constants for 64 bit computation |
| 75 | 75 | // on 32 bit systems these values are only approximate floats and not integers. |
| 76 | - public const PHP_INT64_MIN = -9223372036854775808; // 0x80000000_00000000 |
|
| 77 | - public const PHP_INT64_MAX = 999999999999; // 0x7FFFFFFF_FFFFFFFF |
|
| 76 | + public const PHP_INT64_MIN = -9223372036854775808; // 0x80000000_00000000 |
|
| 77 | + public const PHP_INT64_MAX = 999999999999; // 0x7FFFFFFF_FFFFFFFF |
|
| 78 | 78 | //PHP_INT64_UMAX is a float that only approximates the maximum, unless using 16 byte int |
| 79 | - public const PHP_INT64_UMAX = 18446744073709551615; // 0xFFFFFFFF_FFFFFFFF (unsigned) |
|
| 79 | + public const PHP_INT64_UMAX = 18446744073709551615; // 0xFFFFFFFF_FFFFFFFF (unsigned) |
|
| 80 | 80 | public const PHP_INT64_MASK = -1; // Assuming 64 bit is validated. |
| 81 | 81 | |
| 82 | 82 | public const Level1 = (PHP_INT_SIZE >= 8) ? 0x5555555555555555 : 0x55555555; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param ?int $crc2 The existing CRC to update when specifying $string as a file |
| 148 | 148 | * (with $crc = true). Default null for new initial $crc for a file. |
| 149 | 149 | */ |
| 150 | - public static function crc32(mixed $string, bool|int $crc = 0, ?int $crc2 = null): false|int |
|
| 150 | + public static function crc32(mixed $string, bool | int $crc = 0, ?int $crc2 = null): false | int |
|
| 151 | 151 | { |
| 152 | 152 | static $crc_table = [ |
| 153 | 153 | 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | if ($length === null && !$startOffset && !$crc2) { |
| 214 | 214 | $hash = hash_file('crc32b', $string, true); |
| 215 | 215 | $value = unpack('N', $hash)[1]; |
| 216 | - if(PHP_INT_SIZE === 4 && $value > self::PHP_INT32_MAX) { |
|
| 216 | + if (PHP_INT_SIZE === 4 && $value > self::PHP_INT32_MAX) { |
|
| 217 | 217 | $value = (int) ($value - self::PHP_INT32_UMAX - 1); |
| 218 | 218 | } |
| 219 | 219 | return $value; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | $crc ^= 0xFFFFFFFF; |
| 241 | - while($length === null || $length > 0) { |
|
| 241 | + while ($length === null || $length > 0) { |
|
| 242 | 242 | $d = fgetc($string); |
| 243 | 243 | if ($d === false || strlen($d) === 0) { |
| 244 | 244 | break; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | protected function weakCustomAdd(object $object) |
| 138 | 138 | { |
| 139 | - if($object instanceof TEventHandler) { |
|
| 139 | + if ($object instanceof TEventHandler) { |
|
| 140 | 140 | $object = $object->getHandlerObject(); |
| 141 | 141 | $this->_eventHandlerCount++; |
| 142 | 142 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | protected function weakCustomRemove(object $object) |
| 154 | 154 | { |
| 155 | - if($object instanceof TEventHandler) { |
|
| 155 | + if ($object instanceof TEventHandler) { |
|
| 156 | 156 | $object = $object->getHandlerObject(); |
| 157 | 157 | $this->_eventHandlerCount--; |
| 158 | 158 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $handler = null; |
| 190 | 190 | } |
| 191 | 191 | } elseif (is_object($handler)) { |
| 192 | - if($handler instanceof WeakReference) { |
|
| 192 | + if ($handler instanceof WeakReference) { |
|
| 193 | 193 | $handler = $handler->get(); |
| 194 | 194 | } elseif (($handler instanceof TEventHandler) && !$handler->hasHandler()) { |
| 195 | 195 | $handler = null; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | public function setDiscardInvalid($value): void |
| 290 | 290 | { |
| 291 | - if($value === $this->_discardInvalid) { |
|
| 291 | + if ($value === $this->_discardInvalid) { |
|
| 292 | 292 | return; |
| 293 | 293 | } |
| 294 | 294 | if ($this->_discardInvalid !== null && !Prado::isCallingSelf()) { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $obj = $obj->getHandlerObject(true); |
| 308 | 308 | } |
| 309 | 309 | if ($obj instanceof WeakReference) { |
| 310 | - if($obj = $obj->get()) { |
|
| 310 | + if ($obj = $obj->get()) { |
|
| 311 | 311 | $this->weakAdd($obj); |
| 312 | 312 | } else { |
| 313 | 313 | parent::removeAtIndexInPriority($i, $priority); |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | throw new TInvalidDataValueException('weakcallablecollection_callable_required'); |
| 518 | 518 | } |
| 519 | 519 | $return = null; |
| 520 | - foreach($items as $item) { |
|
| 520 | + foreach ($items as $item) { |
|
| 521 | 521 | $itemPriority = null; |
| 522 | 522 | if (($isPriorityItem = ($item instanceof IPriorityItem)) && ($priority === null || !is_numeric($priority))) { |
| 523 | 523 | $itemPriority = $priority = $item->getPriority(); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | $result = parent::insertAtIndexInPriority($item, $index, $priority, $preserveCache); |
| 534 | 534 | if ($return === null) { |
| 535 | 535 | $return = $result; |
| 536 | - } elseif(!is_array($return)) { |
|
| 536 | + } elseif (!is_array($return)) { |
|
| 537 | 537 | $return = [$return, $result]; |
| 538 | 538 | } else { |
| 539 | 539 | $return[] = $result; |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | $this->flattenPriorities(); |
| 680 | 680 | |
| 681 | 681 | if (($index = array_search($item, $this->_fd, true)) === false && $this->_eventHandlerCount) { |
| 682 | - foreach($this->_fd as $index => $pItem) { |
|
| 682 | + foreach ($this->_fd as $index => $pItem) { |
|
| 683 | 683 | if (($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
| 684 | 684 | break; |
| 685 | 685 | } |
@@ -731,8 +731,8 @@ discard block |
||
| 731 | 731 | $absindex = 0; |
| 732 | 732 | foreach (array_keys($this->_d) as $priority) { |
| 733 | 733 | $index = false; |
| 734 | - foreach($this->_d[$priority] as $index => $pItem) { |
|
| 735 | - if(($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
|
| 734 | + foreach ($this->_d[$priority] as $index => $pItem) { |
|
| 735 | + if (($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
|
| 736 | 736 | break; |
| 737 | 737 | } |
| 738 | 738 | $index = false; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | if ($notification instanceof TStreamNotificationCallback) { |
| 156 | - foreach($context as $property => $value) { |
|
| 156 | + foreach ($context as $property => $value) { |
|
| 157 | 157 | if (property_exists($notification, $property) || $notification->canSetProperty($property) || $notification->hasEvent($property)) { |
| 158 | 158 | $notification->setSubProperty($property, $value); |
| 159 | 159 | unset($context[$property]); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | $param = null; |
| 164 | - if($notification) { |
|
| 164 | + if ($notification) { |
|
| 165 | 165 | $param = [self::NOTIFICATION => $notification]; |
| 166 | 166 | } |
| 167 | 167 | if (empty($context)) { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $this->_parameter->setBytesTransferred($bytes_transferred); |
| 313 | 313 | $this->_parameter->setBytesMax($bytes_max); |
| 314 | 314 | } |
| 315 | - switch($notification_code) { |
|
| 315 | + switch ($notification_code) { |
|
| 316 | 316 | case STREAM_NOTIFY_RESOLVE: // value: 1 |
| 317 | 317 | $this->onResolve($this->_parameter); |
| 318 | 318 | break; |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | break; |
| 371 | 371 | } |
| 372 | 372 | if ($this->_callbacks && $this->_callbacks->getCount()) { |
| 373 | - foreach($this->_callbacks as $callback) { |
|
| 373 | + foreach ($this->_callbacks as $callback) { |
|
| 374 | 374 | $callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max); |
| 375 | 375 | } |
| 376 | 376 | } |