| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function write($message) |
||
| 31 | { |
||
| 32 | // Create a handler in order to handle the 'Host is down' message |
||
| 33 | 5 | set_error_handler(function() { |
|
| 34 | // Suppress the error, this is the UDP adapter and if we can't send |
||
| 35 | // it then we shouldn't inturrupt their application. |
||
| 36 | 5 | }); |
|
| 37 | |||
| 38 | 5 | $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
|
| 39 | 5 | socket_sendto($socket, $message, strlen($message), 0, $this->getOptions()->getHost(), $this->getOptions()->getPort()); |
|
| 40 | 5 | socket_close($socket); |
|
| 41 | |||
| 42 | // Remove our error handler. |
||
| 43 | 5 | restore_error_handler(); |
|
| 44 | 5 | } |
|
| 45 | } |
||
| 46 |