| Conditions | 6 |
| Paths | 4 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function run() |
||
| 19 | { |
||
| 20 | if ($this->stage++ > 0) { |
||
| 21 | $this->header('500 Too Busy'); |
||
| 22 | return; |
||
| 23 | } |
||
| 24 | if ($this->attrs->raw === '') { |
||
| 25 | $this->header('500 Internal Server Error'); |
||
| 26 | echo 'Payload expected.'; |
||
| 27 | return; |
||
| 28 | } |
||
| 29 | if (!json_decode($this->attrs->raw, true)) { |
||
| 30 | $this->header('500 Internal Server Error'); |
||
| 31 | echo 'Broken JSON encoding.'; |
||
| 32 | return; |
||
| 33 | } |
||
| 34 | $this->appInstance->publish('c2s:' . $this->sessId, $this->attrs->raw, function ($redis) { |
||
|
|
|||
| 35 | if (!$this->headers_sent) { |
||
| 36 | if ($redis->result === 0) { |
||
| 37 | $this->header('404 Not Found'); |
||
| 38 | } else { |
||
| 39 | $this->header('204 No Content'); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | $this->finish(); |
||
| 43 | }); |
||
| 44 | $this->sleep(10); |
||
| 45 | } |
||
| 46 | } |
||
| 47 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: