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 | 7 | public function parse($payload) |
|
26 | { |
||
27 | 7 | if (function_exists('msgpack_unpack')) { |
|
28 | 6 | if ($payload) { |
|
29 | 4 | $prevHandler = set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) { |
|
30 | throw new ParserException('Failed To Parse MSGPack'); // @codeCoverageIgnore |
||
31 | 4 | }); |
|
32 | |||
33 | 4 | $msg = msgpack_unpack(trim($payload)); |
|
34 | 2 | if ( ! $msg) { |
|
35 | set_error_handler($prevHandler); // @codeCoverageIgnore |
||
36 | throw new ParserException('Failed To Parse MSGPack'); // @codeCoverageIgnore |
||
37 | } |
||
38 | |||
39 | 2 | set_error_handler($prevHandler); |
|
40 | |||
41 | 2 | return $msg; |
|
42 | } |
||
43 | 2 | 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.