| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 8.2515 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 2 | public function __construct(TelnetResponseInterface $telnetResponse) |
|
| 22 | { |
||
| 23 | try { |
||
| 24 | 2 | $xml = @new SimpleXMLElement($telnetResponse->getResponseText(), 0, false, 'cw', true); |
|
| 25 | 2 | } catch (Exception $e) { |
|
| 26 | 2 | $this->setError($e->getMessage()); |
|
| 27 | 2 | return; |
|
| 28 | } |
||
| 29 | |||
| 30 | $xmlConverter = new XmlConverter(); |
||
| 31 | $this->contents = $xmlConverter->convertToArray($xml); |
||
| 32 | |||
| 33 | if ($telnetResponse->isError()) { |
||
| 34 | $error = 'unknown'; |
||
| 35 | if (isset($this->contents['error_info']['error_text'])) { |
||
| 36 | $error = $this->contents['error_info']['error_text']; |
||
| 37 | } |
||
| 38 | |||
| 39 | $this->setError('Telnet response error: '.$error); |
||
| 40 | return; |
||
| 41 | } |
||
| 42 | |||
| 43 | $this->parseContents($this->contents); |
||
| 44 | } |
||
| 93 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.