Conditions | 3 |
Paths | 3 |
Total Lines | 25 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
21 | public function initScanner(){ |
||
22 | parent::initScanner(); |
||
23 | $this->writeHandle = stream_socket_client( |
||
24 | 'unix://' . $this->appConfig->getAvSocket(), $errorCode, $errorMessage, 5 |
||
25 | ); |
||
26 | if (!$this->getWriteHandle()) { |
||
27 | throw new InitException( |
||
28 | sprintf( |
||
29 | 'Could not connect to socket "%s": %s (code %d)', |
||
30 | $this->appConfig->getAvSocket(), |
||
31 | $errorMessage, |
||
32 | $errorCode |
||
33 | ) |
||
34 | ); |
||
35 | } |
||
36 | |||
37 | if (@fwrite($this->getWriteHandle(), "nINSTREAM\n") === false) { |
||
38 | throw new InitException( |
||
39 | sprintf( |
||
40 | 'Writing to socket "%s" failed', |
||
41 | $this->appConfig->getAvSocket() |
||
42 | ) |
||
43 | ); |
||
44 | } |
||
45 | } |
||
46 | } |
||
47 |