| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 3 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 25 | 5 | public function parse($payload) |
|
| 26 | { |
||
| 27 | 5 | if (function_exists('msgpack_unpack')) { |
|
| 28 | 3 | if ($payload) { |
|
| 29 | 2 | $prevHandler = set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) { |
|
| 30 | throw new ParserException('Failed To Parse MSGPack'); // @codeCoverageIgnore |
||
| 31 | 2 | }); |
|
| 32 | |||
| 33 | 2 | $msg = msgpack_unpack(trim($payload)); |
|
| 34 | 1 | if ( ! $msg) { |
|
| 35 | set_error_handler($prevHandler); // @codeCoverageIgnore |
||
| 36 | throw new ParserException('Failed To Parse MSGPack'); // @codeCoverageIgnore |
||
| 37 | } |
||
| 38 | |||
| 39 | 1 | set_error_handler($prevHandler); |
|
| 40 | |||
| 41 | 1 | return $msg; |
|
| 42 | } |
||
| 43 | 1 | return []; |
|
| 44 | } |
||
| 45 | |||
| 46 | throw new ParserException('Failed To Parse MSGPack - Supporting Library Not Available'); // @codeCoverageIgnore |
||
| 47 | } |
||
| 48 | } |
||
| 49 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.