@@ -191,7 +191,7 @@ |
||
| 191 | 191 | $weightLightCutOff = 0.4; |
| 192 | 192 | if ($normalizedTime > $weightCutOff) { |
| 193 | 193 | $weight = '; font-weight: ' . round(400 + 500 * ($normalizedTime - $weightCutOff) / (1 - $weightCutOff)); |
| 194 | - } elseif($normalizedTime < $weightLightCutOff) { |
|
| 194 | + } elseif ($normalizedTime < $weightLightCutOff) { |
|
| 195 | 195 | $weight = '; font-weight: ' . round(400 - 300 * ($weightLightCutOff - $normalizedTime) / ($weightLightCutOff)); |
| 196 | 196 | } else { |
| 197 | 197 | $weight = ''; |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function __construct(bool $flushShutdown = true) |
| 144 | 144 | { |
| 145 | - if($flushShutdown) { |
|
| 146 | - register_shutdown_function(function () { |
|
| 145 | + if ($flushShutdown) { |
|
| 146 | + register_shutdown_function(function() { |
|
| 147 | 147 | $this->onFlushLogs(); |
| 148 | 148 | // flush any logs in the shutdown function. |
| 149 | 149 | register_shutdown_function([$this, 'onFlushLogs'], $this, true); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @return int The number of logs. |
| 215 | 215 | * @since 4.2.3 |
| 216 | 216 | */ |
| 217 | - public function getLogCount(null|bool|int $selector = null): int |
|
| 217 | + public function getLogCount(null | bool | int $selector = null): int |
|
| 218 | 218 | { |
| 219 | 219 | if ($selector === null) {// logs @TLogRoute::processLogs after removing logged elements. |
| 220 | 220 | return count($this->_logs) + $this->_profileLogsCount; |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | return; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - if(is_bool($sender)) { |
|
| 402 | + if (is_bool($sender)) { |
|
| 403 | 403 | $final = $sender; |
| 404 | 404 | $sender = null; |
| 405 | 405 | } |
@@ -416,14 +416,14 @@ discard block |
||
| 416 | 416 | $this->deleteLogs(); |
| 417 | 417 | $this->_flushing = false; |
| 418 | 418 | if (count($this->_flushingLog)) { |
| 419 | - foreach($this->_flushingLog as $log) { |
|
| 419 | + foreach ($this->_flushingLog as $log) { |
|
| 420 | 420 | $this->addLog($log, false); // $final = false to stop any possible recursion w/ low flushCount. |
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | $this->_flushingLog = null; |
| 424 | 424 | |
| 425 | 425 | $this->_profileLogsCount = 0; |
| 426 | - foreach(array_keys($this->_profileLogs) as $key) { |
|
| 426 | + foreach (array_keys($this->_profileLogs) as $key) { |
|
| 427 | 427 | $this->_profileLogs[$key][static::LOG_LEVEL] |= static::LOGGED; |
| 428 | 428 | } |
| 429 | 429 | } |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * [6] => traces, when configured; null when absent |
| 467 | 467 | * [7] => process id) |
| 468 | 468 | */ |
| 469 | - public function getLogs(?int $levels = null, null|array|string $categories = null, null|array|string $controls = null, null|int|float $timestamp = null, ?int $pid = null) |
|
| 469 | + public function getLogs(?int $levels = null, null | array | string $categories = null, null | array | string $controls = null, null | int | float $timestamp = null, ?int $pid = null) |
|
| 470 | 470 | { |
| 471 | 471 | $this->_levels = $levels; |
| 472 | 472 | if (!empty($categories) && !is_array($categories)) { |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | public function mergeLogs(array $logs) |
| 516 | 516 | { |
| 517 | 517 | $count = count($logs); |
| 518 | - foreach($logs as $log) { |
|
| 518 | + foreach ($logs as $log) { |
|
| 519 | 519 | $log[static::LOG_LEVEL] &= ~TLogger::LOGGED; |
| 520 | 520 | $this->addLog($log, !(--$count)); |
| 521 | 521 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | * @param ?int $pid |
| 549 | 549 | * @return array The logs being delete are returned. |
| 550 | 550 | */ |
| 551 | - public function deleteLogs(?int $levels = null, null|string|array $categories = null, null|string|array $controls = null, null|int|float $timestamp = null, ?int $pid = null): array |
|
| 551 | + public function deleteLogs(?int $levels = null, null | string | array $categories = null, null | string | array $controls = null, null | int | float $timestamp = null, ?int $pid = null): array |
|
| 552 | 552 | { |
| 553 | 553 | $this->_levels = $levels; |
| 554 | 554 | if (!empty($categories) && !is_array($categories)) { |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | } |
| 633 | 633 | $c = $category[0] ?? 0; |
| 634 | 634 | if ($c === '!' || $c === '~') { |
| 635 | - if(!$exclude) { |
|
| 635 | + if (!$exclude) { |
|
| 636 | 636 | $category = substr($category, 1); |
| 637 | 637 | if ($log[static::LOG_CATEGORY] === $category || str_ends_with($category, '*') && strpos($log[static::LOG_CATEGORY], rtrim($category, '*')) === 0) { |
| 638 | 638 | $exclude = true; |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | } |
| 690 | 690 | $c = $control[0] ?? 0; |
| 691 | 691 | if ($c === '!' || $c === '~') { |
| 692 | - if(!$exclude) { |
|
| 692 | + if (!$exclude) { |
|
| 693 | 693 | $control = substr($control, 1); |
| 694 | 694 | if ($log[static::LOG_CONTROL] === $control || str_ends_with($control, '*') && strpos($log[static::LOG_CONTROL], rtrim($control, '*')) === 0) { |
| 695 | 695 | $exclude = true; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param ?bool $autoSubscribe Default null for autoSubscribing when there is a |
| 42 | 42 | * key or item. |
| 43 | 43 | */ |
| 44 | - public function __construct(?ArrayAccess $collection = null, mixed $key = null, mixed $item = null, null|int|float $priority = null, null|bool|int $isAssociative = 1, ?bool $autoSubscribe = null) |
|
| 44 | + public function __construct(?ArrayAccess $collection = null, mixed $key = null, mixed $item = null, null | int | float $priority = null, null | bool | int $isAssociative = 1, ?bool $autoSubscribe = null) |
|
| 45 | 45 | { |
| 46 | 46 | parent::__construct($collection, $key, $item, $priority, $isAssociative, $autoSubscribe); |
| 47 | 47 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * The ArrayAccess collection for getting the array without pass by reference. |
| 51 | 51 | * @param bool $weak Return the collection in as a WeakReference. |
| 52 | 52 | */ |
| 53 | - public function getCollection(bool $weak = false): null|ArrayAccess|WeakReference |
|
| 53 | + public function getCollection(bool $weak = false): null | ArrayAccess | WeakReference |
|
| 54 | 54 | { |
| 55 | 55 | return $this->getArray($weak); |
| 56 | 56 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | protected function weakCustomAdd(object $object) |
| 123 | 123 | { |
| 124 | - if($object instanceof TEventHandler) { |
|
| 124 | + if ($object instanceof TEventHandler) { |
|
| 125 | 125 | $object = $object->getHandlerObject(); |
| 126 | 126 | $this->_eventHandlerCount++; |
| 127 | 127 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | protected function weakCustomRemove(object $object) |
| 139 | 139 | { |
| 140 | - if($object instanceof TEventHandler) { |
|
| 140 | + if ($object instanceof TEventHandler) { |
|
| 141 | 141 | $object = $object->getHandlerObject(); |
| 142 | 142 | $this->_eventHandlerCount--; |
| 143 | 143 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $item[$key] = $element; |
| 162 | 162 | } |
| 163 | 163 | } elseif (is_object($item)) { |
| 164 | - if($item instanceof WeakReference) { |
|
| 164 | + if ($item instanceof WeakReference) { |
|
| 165 | 165 | $item = $item->get(); |
| 166 | 166 | } elseif (($item instanceof TEventHandler) && !$item->hasHandler()) { |
| 167 | 167 | $item = null; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | if ($isEventHandler = ($object instanceof TEventHandler)) { |
| 208 | 208 | $object = $object->getHandlerObject(true); |
| 209 | 209 | } |
| 210 | - if(($object instanceof WeakReference) && $object->get() === null) { |
|
| 210 | + if (($object instanceof WeakReference) && $object->get() === null) { |
|
| 211 | 211 | $this->_c--; |
| 212 | 212 | if ($i === $this->_c) { |
| 213 | 213 | array_pop($this->_d); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function setDiscardInvalid($value): void |
| 249 | 249 | { |
| 250 | - if($value === $this->_discardInvalid) { |
|
| 250 | + if ($value === $this->_discardInvalid) { |
|
| 251 | 251 | return; |
| 252 | 252 | } |
| 253 | 253 | if ($this->_discardInvalid !== null && !Prado::isCallingSelf()) { |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $object = $object->get(); |
| 267 | 267 | } |
| 268 | 268 | if ($object === null) { |
| 269 | - $this->_c--; //on read only, parent::removeAt won't remove for scrub. |
|
| 269 | + $this->_c--; //on read only, parent::removeAt won't remove for scrub. |
|
| 270 | 270 | if ($i === $this->_c) { |
| 271 | 271 | array_pop($this->_d); |
| 272 | 272 | } else { |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | $this->filterItemForInput($item); |
| 446 | 446 | if (($index = parent::indexOf($item)) === -1 && $this->_eventHandlerCount) { |
| 447 | 447 | $index = false; |
| 448 | - foreach($this->_d as $index => $dItem) { |
|
| 448 | + foreach ($this->_d as $index => $dItem) { |
|
| 449 | 449 | if (($dItem instanceof TEventHandler) && $dItem->isSameHandler($item, true)) { |
| 450 | 450 | break; |
| 451 | 451 | } |
@@ -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 | if (!$object) { |
| 142 | 142 | return; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | protected function weakCustomRemove(object $object) |
| 157 | 157 | { |
| 158 | - if($object instanceof TEventHandler) { |
|
| 158 | + if ($object instanceof TEventHandler) { |
|
| 159 | 159 | $object = $object->getHandlerObject(); |
| 160 | 160 | if (!$object) { |
| 161 | 161 | return; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $handler = null; |
| 196 | 196 | } |
| 197 | 197 | } elseif (is_object($handler)) { |
| 198 | - if($handler instanceof WeakReference) { |
|
| 198 | + if ($handler instanceof WeakReference) { |
|
| 199 | 199 | $handler = $handler->get(); |
| 200 | 200 | } elseif (($handler instanceof TEventHandler) && !$handler->hasHandler()) { |
| 201 | 201 | $handler = null; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function setDiscardInvalid($value): void |
| 296 | 296 | { |
| 297 | - if($value === $this->_discardInvalid) { |
|
| 297 | + if ($value === $this->_discardInvalid) { |
|
| 298 | 298 | return; |
| 299 | 299 | } |
| 300 | 300 | if ($this->_discardInvalid !== null && !Prado::isCallingSelf()) { |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $obj = $obj->getHandlerObject(true); |
| 314 | 314 | } |
| 315 | 315 | if ($obj instanceof WeakReference) { |
| 316 | - if($obj = $obj->get()) { |
|
| 316 | + if ($obj = $obj->get()) { |
|
| 317 | 317 | $this->weakAdd($obj); |
| 318 | 318 | } else { |
| 319 | 319 | parent::removeAtIndexInPriority($i, $priority); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | throw new TInvalidDataValueException('weakcallablecollection_callable_required'); |
| 525 | 525 | } |
| 526 | 526 | $return = null; |
| 527 | - foreach($items as $item) { |
|
| 527 | + foreach ($items as $item) { |
|
| 528 | 528 | $itemPriority = null; |
| 529 | 529 | if (($isPriorityItem = ($item instanceof IPriorityItem)) && ($priority === null || !is_numeric($priority))) { |
| 530 | 530 | $itemPriority = $priority = $item->getPriority(); |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | $result = parent::insertAtIndexInPriority($item, $index, $priority, $preserveCache); |
| 541 | 541 | if ($return === null) { |
| 542 | 542 | $return = $result; |
| 543 | - } elseif(!is_array($return)) { |
|
| 543 | + } elseif (!is_array($return)) { |
|
| 544 | 544 | $return = [$return, $result]; |
| 545 | 545 | } else { |
| 546 | 546 | $return[] = $result; |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | continue; |
| 714 | 714 | } elseif ($p == $priority) { |
| 715 | 715 | $index = false; |
| 716 | - foreach($this->_d[$p] as $index => $pItem) { |
|
| 716 | + foreach ($this->_d[$p] as $index => $pItem) { |
|
| 717 | 717 | if ($item === $pItem || ($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
| 718 | 718 | break; |
| 719 | 719 | } |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | $this->flattenPriorities(); |
| 732 | 732 | |
| 733 | 733 | if (($index = array_search($item, $this->_fd, true)) === false && $this->_eventHandlerCount) { |
| 734 | - foreach($this->_fd as $index => $pItem) { |
|
| 734 | + foreach ($this->_fd as $index => $pItem) { |
|
| 735 | 735 | if (($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
| 736 | 736 | break; |
| 737 | 737 | } |
@@ -783,8 +783,8 @@ discard block |
||
| 783 | 783 | $absindex = 0; |
| 784 | 784 | foreach (array_keys($this->_d) as $priority) { |
| 785 | 785 | $index = false; |
| 786 | - foreach($this->_d[$priority] as $index => $pItem) { |
|
| 787 | - if(($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
|
| 786 | + foreach ($this->_d[$priority] as $index => $pItem) { |
|
| 787 | + if (($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
|
| 788 | 788 | break; |
| 789 | 789 | } |
| 790 | 790 | $index = false; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param ?bool $autoSubscribe |
| 50 | 50 | * @param mixed $index |
| 51 | 51 | */ |
| 52 | - public function __construct(?TComponent $component = null, mixed $event = null, mixed $handler = null, null|int|float $priority = null, ?bool $autoSubscribe = null, mixed $index = null) |
|
| 52 | + public function __construct(?TComponent $component = null, mixed $event = null, mixed $handler = null, null | int | float $priority = null, ?bool $autoSubscribe = null, mixed $index = null) |
|
| 53 | 53 | { |
| 54 | 54 | if ($component) { |
| 55 | 55 | $this->setComponent($component); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param bool $weak |
| 66 | 66 | * @return null|array|ArrayAccess|WeakReference The Event Handler from the component. |
| 67 | 67 | */ |
| 68 | - public function &getArray(bool $weak = false): array|ArrayAccess|WeakReference|null |
|
| 68 | + public function &getArray(bool $weak = false): array | ArrayAccess | WeakReference | null |
|
| 69 | 69 | { |
| 70 | 70 | if ($handlers = parent::getArray($weak)) { |
| 71 | 71 | return $handlers; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param null|array|ArrayAccess $value |
| 101 | 101 | * @throws TInvalidOperationException This property cannot be set directly. |
| 102 | 102 | */ |
| 103 | - public function setArray(null|array|ArrayAccess &$value): static |
|
| 103 | + public function setArray(null | array | ArrayAccess & $value): static |
|
| 104 | 104 | { |
| 105 | 105 | if ($value !== null) { |
| 106 | 106 | throw new TInvalidOperationException('eventsubscription_no_setarray'); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * @return bool is the array a list. |
| 29 | 29 | * @link https://www.php.net/manual/en/function.array-is-list.php |
| 30 | 30 | */ |
| 31 | - public static function array_is_list(array|Traversable $array): bool |
|
| 31 | + public static function array_is_list(array | Traversable $array): bool |
|
| 32 | 32 | { |
| 33 | 33 | if (function_exists('array_is_list') && !($array instanceof Traversable)) { |
| 34 | 34 | return array_is_list($array); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | /** |
| 79 | 79 | * @var null|int|string The key that the item is added to the array. |
| 80 | 80 | */ |
| 81 | - private null|int|string $_key = null; |
|
| 81 | + private null | int | string $_key = null; |
|
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * @var mixed The item subscribing to the array. |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @var null|bool|int Is the array an associative array. False for a "list" style array. |
| 96 | 96 | * null for discovery of the style of array on subscribe. default true. |
| 97 | 97 | */ |
| 98 | - protected null|bool|int $_isAssoc = true; |
|
| 98 | + protected null | bool | int $_isAssoc = true; |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * @var bool Is the item inserted into the collection. |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * the item. Default 1 for true except for TList. |
| 136 | 136 | * @param bool $autoSubscribe Should the |
| 137 | 137 | */ |
| 138 | - public function __construct(mixed &$array = null, mixed $key = null, mixed $item = null, null|int|float $priority = null, null|bool|int $isAssociative = 1, ?bool $autoSubscribe = null) |
|
| 138 | + public function __construct(mixed &$array = null, mixed $key = null, mixed $item = null, null | int | float $priority = null, null | bool | int $isAssociative = 1, ?bool $autoSubscribe = null) |
|
| 139 | 139 | { |
| 140 | 140 | $this->setArray($array); |
| 141 | 141 | $this->setKey($key); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param bool $weak |
| 178 | 178 | * @return array|ArrayAccess The subscribed array-collection, passed by reference. |
| 179 | 179 | */ |
| 180 | - public function &getArray(bool $weak = false): array|ArrayAccess|WeakReference|null |
|
| 180 | + public function &getArray(bool $weak = false): array | ArrayAccess | WeakReference | null |
|
| 181 | 181 | { |
| 182 | 182 | if ($this->_array instanceof WeakReference) { |
| 183 | 183 | if ($weak) { |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @throws TInvalidOperationException If the item is already subscribed. |
| 203 | 203 | * @return static The current object. |
| 204 | 204 | */ |
| 205 | - public function setArray(null|array|ArrayAccess &$value): static |
|
| 205 | + public function setArray(null | array | ArrayAccess & $value): static |
|
| 206 | 206 | { |
| 207 | 207 | if ($this->_isSubscribed) { |
| 208 | 208 | throw new TInvalidOperationException('arraysubscription_no_change', 'Array'); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * with the TList (by {@see \Prado\Collections\TList::indexOf()}) or array (by array_search). |
| 224 | 224 | * @return null|int|string The key for the item subscription to the array. |
| 225 | 225 | */ |
| 226 | - public function getKey(): null|int|string |
|
| 226 | + public function getKey(): null | int | string |
|
| 227 | 227 | { |
| 228 | 228 | $collection = &$this->getArray(); |
| 229 | 229 | if ($this->_isSubscribed && $this->_key === null) { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * as a list from (0, ..., count() - 1). if null, where needed, the "list"ness |
| 323 | 323 | * of the array will be determined by {@see \Prado\Util\Helpers\TArrayHelper::array_is_list()}. |
| 324 | 324 | */ |
| 325 | - public function getIsAssociative(): null|bool|int |
|
| 325 | + public function getIsAssociative(): null | bool | int |
|
| 326 | 326 | { |
| 327 | 327 | return $this->_isAssoc; |
| 328 | 328 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @throws TInvalidOperationException If the item is already subscribed. |
| 335 | 335 | * @return static The current object. |
| 336 | 336 | */ |
| 337 | - public function setIsAssociative(null|bool|int $value = null): static |
|
| 337 | + public function setIsAssociative(null | bool | int $value = null): static |
|
| 338 | 338 | { |
| 339 | 339 | if ($this->_isSubscribed) { |
| 340 | 340 | throw new TInvalidOperationException('arraysubscription_no_change', 'Key'); |
@@ -94,17 +94,17 @@ discard block |
||
| 94 | 94 | SIGALRM => self::FX_SIGNAL_ALARM, // Alarm signal. Sent by pcntl_alarm when the time is over. |
| 95 | 95 | SIGHUP => self::FX_SIGNAL_HANG_UP, // Hangup signal. Sent to a process when its controlling terminal is closed. |
| 96 | 96 | SIGINT => self::FX_SIGNAL_INTERRUPT, // Interrupt signal. Typically generated by pressing Ctrl+C. |
| 97 | - SIGQUIT => self::FX_SIGNAL_QUIT, // Quit signal. Similar to SIGINT but produces a core dump when received by the process. |
|
| 98 | - SIGTRAP => self::FX_SIGNAL_TRAP, // Trace/breakpoint trap signal. Used by debuggers to catch trace and breakpoint conditions. |
|
| 97 | + SIGQUIT => self::FX_SIGNAL_QUIT, // Quit signal. Similar to SIGINT but produces a core dump when received by the process. |
|
| 98 | + SIGTRAP => self::FX_SIGNAL_TRAP, // Trace/breakpoint trap signal. Used by debuggers to catch trace and breakpoint conditions. |
|
| 99 | 99 | SIGABRT => self::FX_SIGNAL_ABORT, // Abort signal. Sent by the process itself to terminate due to a critical error condition. |
| 100 | 100 | SIGUSR1 => self::FX_SIGNAL_USER1, // User-defined signal 1. |
| 101 | 101 | SIGUSR2 => self::FX_SIGNAL_USER2, // User-defined signal 2. |
| 102 | 102 | SIGTERM => self::FX_SIGNAL_TERMINATE, // Termination signal. Typically used to request graceful termination of a process. |
| 103 | 103 | SIGCHLD => self::FX_SIGNAL_CHILD, // Child signal. Sent to a parent process when a child process terminates. |
| 104 | - SIGCONT => self::FX_SIGNAL_CONTINUE, // Continue signal. Sent to resume a process that has been stopped. |
|
| 104 | + SIGCONT => self::FX_SIGNAL_CONTINUE, // Continue signal. Sent to resume a process that has been stopped. |
|
| 105 | 105 | SIGTSTP => self::FX_SIGNAL_TERMINAL_STOP, // Terminal stop signal. Sent by pressing Ctrl+Z to suspend the process. |
| 106 | - SIGTTIN => self::FX_SIGNAL_BACKGROUND_READ, // Background read signal. Sent to a process when it attempts to read from the terminal while in the background. |
|
| 107 | - SIGTTOU => self::FX_SIGNAL_BACKGROUND_WRITE, // Background write signal. Sent to a process when it attempts to write to the terminal while in the background. |
|
| 106 | + SIGTTIN => self::FX_SIGNAL_BACKGROUND_READ, // Background read signal. Sent to a process when it attempts to read from the terminal while in the background. |
|
| 107 | + SIGTTOU => self::FX_SIGNAL_BACKGROUND_WRITE, // Background write signal. Sent to a process when it attempts to write to the terminal while in the background. |
|
| 108 | 108 | SIGURG => self::FX_SIGNAL_URGENT, // Urgent condition signal. Indicates the arrival of out-of-band data on a socket. |
| 109 | 109 | ]; |
| 110 | 110 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | static::setAsyncSignals(true); |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - foreach(static::SIGNAL_MAP as $signal => $event) { |
|
| 226 | + foreach (static::SIGNAL_MAP as $signal => $event) { |
|
| 227 | 227 | $handler = pcntl_signal_get_handler($signal); |
| 228 | 228 | |
| 229 | 229 | if ($handler instanceof self) { |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $callable = is_callable($handler); |
| 235 | 235 | if ($callable) { |
| 236 | - $handler = function ($sender, $param) use ($handler) { |
|
| 236 | + $handler = function($sender, $param) use ($handler) { |
|
| 237 | 237 | return $handler($param->getSignal(), $param->getParameter()); |
| 238 | 238 | }; |
| 239 | 239 | self::$_priorHandlers[$signal][1] = $handler; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | return false; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - foreach(self::$_priorHandlers as $signal => $originalCallback) { |
|
| 280 | + foreach (self::$_priorHandlers as $signal => $originalCallback) { |
|
| 281 | 281 | pcntl_signal($signal, $originalCallback[0]); |
| 282 | 282 | $uninstallHandler = true; |
| 283 | 283 | switch ($signal) { |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | { |
| 326 | 326 | if (isset(static::SIGNAL_MAP[$name])) { |
| 327 | 327 | $name = static::SIGNAL_MAP[$name]; |
| 328 | - } elseif(strncasecmp('pid:', $name, 4) === 0) { |
|
| 328 | + } elseif (strncasecmp('pid:', $name, 4) === 0) { |
|
| 329 | 329 | if (is_numeric($pid = trim(substr($name, 4)))) { |
| 330 | 330 | return TProcessHelper::isRunning((int) $pid); |
| 331 | 331 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | { |
| 348 | 348 | if (isset(static::SIGNAL_MAP[$name])) { |
| 349 | 349 | $name = static::SIGNAL_MAP[$name]; |
| 350 | - } elseif(strncasecmp('pid:', $name, 4) === 0) { |
|
| 350 | + } elseif (strncasecmp('pid:', $name, 4) === 0) { |
|
| 351 | 351 | if (is_numeric($pid = trim(substr($name, 4)))) { |
| 352 | 352 | $pid = (int) $pid; |
| 353 | 353 | return isset(self::$_pidHandlers[$pid]) && self::$_pidHandlers[$pid]->getCount() > 0; |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | { |
| 371 | 371 | if (isset(static::SIGNAL_MAP[$name])) { |
| 372 | 372 | $name = static::SIGNAL_MAP[$name]; |
| 373 | - } elseif(strncasecmp('pid:', $name, 4) === 0) { |
|
| 373 | + } elseif (strncasecmp('pid:', $name, 4) === 0) { |
|
| 374 | 374 | if (!is_numeric($pid = trim(substr($name, 4)))) { |
| 375 | 375 | throw new TInvalidOperationException('signalsdispatcher_bad_pid', $pid); |
| 376 | 376 | } |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | $callback = self::$_priorHandlers[SIGALRM][1]; |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | - foreach($alarmTime !== null ? [$alarmTime] : array_keys(static::$_alarms) as $time) { |
|
| 623 | + foreach ($alarmTime !== null ? [$alarmTime] : array_keys(static::$_alarms) as $time) { |
|
| 624 | 624 | if (($key = array_search($callback, static::$_alarms[$time] ?? [], true)) !== false) { |
| 625 | 625 | unset(static::$_alarms[$time][$key]); |
| 626 | 626 | if (is_array(static::$_alarms[$time] ?? false)) { |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | $nextTime = null; |
| 662 | 662 | $startTime = time(); |
| 663 | 663 | $signalParam->setAlarmTime($startTime); |
| 664 | - foreach(static::$_alarms as $alarmTime => $alarms) { |
|
| 664 | + foreach (static::$_alarms as $alarmTime => $alarms) { |
|
| 665 | 665 | if ($alarmTime <= $startTime) { |
| 666 | 666 | array_map(fn ($alarm) => $alarm($this, $signalParam), static::$_alarms[$alarmTime]); |
| 667 | 667 | unset(static::$_alarms[$alarmTime]); |