| Conditions | 4 |
| Paths | 7 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 102 | public function handleWriteEvent() |
||
| 103 | { |
||
| 104 | foreach ($this->messages as $i=>$message) |
||
| 105 | { |
||
| 106 | try |
||
| 107 | { |
||
| 108 | $message = (array) $message; |
||
| 109 | $sent = (bool) $this->socket->sendmulti($message, ZMQ::MODE_DONTWAIT); |
||
|
|
|||
| 110 | unset($this->messages[$i]); |
||
| 111 | if (0 === count($this->messages)) |
||
| 112 | { |
||
| 113 | $this->loop->removeWriteStream($this->fd); |
||
| 114 | $this->listening = false; |
||
| 115 | $this->emit('end'); |
||
| 116 | } |
||
| 117 | } |
||
| 118 | catch (ZMQSocketException $ex) |
||
| 119 | { |
||
| 120 | $this->emit('error', [ $ex ]); |
||
| 121 | } |
||
| 122 | } |
||
| 123 | } |
||
| 124 | } |
||
| 125 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.