| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 2.0009 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 2 | private function register(): void |
|
| 36 | { |
||
| 37 | 2 | if ($this->handlersRegistered === true) { |
|
| 38 | return; |
||
| 39 | } |
||
| 40 | |||
| 41 | 2 | pcntl_async_signals(true); |
|
| 42 | |||
| 43 | 2 | $softClose = function(): void { |
|
| 44 | 2 | $this->close(); |
|
| 45 | 2 | }; |
|
| 46 | |||
| 47 | 2 | pcntl_signal(SIGHUP, static function() { |
|
| 48 | //do nothing so it can run in background |
||
| 49 | 2 | }); |
|
| 50 | 2 | pcntl_signal(SIGINT, $softClose); |
|
| 51 | 2 | pcntl_signal(SIGABRT, $softClose); |
|
| 52 | 2 | pcntl_signal(SIGTERM, $softClose); |
|
| 53 | 2 | pcntl_signal(SIGTSTP, $softClose); |
|
| 54 | 2 | pcntl_signal(SIGALRM, $softClose); |
|
| 55 | 2 | $this->handlersRegistered = true; |
|
| 56 | 2 | } |
|
| 57 | } |
||
| 58 |