| Conditions | 5 |
| Paths | 6 |
| Total Lines | 24 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 39 | public function doWork(swoole_server $server, $fd, $data, $from_id) |
||
| 40 | { |
||
| 41 | switch (trim($data)) { |
||
| 42 | case 'quit': |
||
| 43 | $server->send($fd, 'connection closed'); |
||
| 44 | $server->close($fd); |
||
| 45 | |||
| 46 | break; |
||
| 47 | case 'reload': |
||
| 48 | $this->getSwoole()->reload(); |
||
| 49 | |||
| 50 | break; |
||
| 51 | case 'status': |
||
| 52 | default: |
||
| 53 | $info = $server->stats(); |
||
| 54 | $status = ''; |
||
| 55 | foreach ($info as $key => $value) { |
||
| 56 | $status .= '['.date('Y-m-d H:i:s').']: '.$key.': '.$value.PHP_EOL; |
||
| 57 | } |
||
| 58 | $server->send($fd, $status); |
||
| 59 | |||
| 60 | break; |
||
| 61 | } |
||
| 62 | } |
||
| 63 | } |
||
| 64 |