| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function initScanner(){ |
||
| 15 | parent::initScanner(); |
||
| 16 | |||
| 17 | $this->writeHandle = stream_socket_client( |
||
| 18 | 'unix://' . $this->appConfig->getAvSocket(), $errorCode, $errorMessage, 5 |
||
| 19 | ); |
||
| 20 | if (!$this->getWriteHandle()) { |
||
| 21 | throw new InitException( |
||
| 22 | sprintf( |
||
| 23 | 'Could not connect to socket "%s": %s (code %d)', |
||
| 24 | $this->appConfig->getAvSocket(), |
||
| 25 | $errorMessage, |
||
| 26 | $errorCode |
||
| 27 | ) |
||
| 28 | ); |
||
| 29 | } |
||
| 30 | |||
| 31 | // request scan from the daemon |
||
| 32 | @fwrite($this->getWriteHandle(), "nINSTREAM\n"); |
||
|
|
|||
| 33 | } |
||
| 34 | } |
||
| 35 |
If you suppress an error, we recommend checking for the error condition explicitly: