Conditions | 4 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 2 |
CRAP Score | 12.192 |
Changes | 3 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
25 | 3 | public function parse($payload) |
|
26 | { |
||
27 | 3 | if (function_exists('msgpack_unpack')) { |
|
28 | if ($payload) { |
||
29 | $prevHandler = set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) { |
||
30 | throw new ParserException('Failed To Parse MSGPack'); // @codeCoverageIgnore |
||
31 | }); |
||
32 | |||
33 | $msg = msgpack_unpack(trim($payload)); |
||
34 | if ( ! $msg) { |
||
35 | set_error_handler($prevHandler); // @codeCoverageIgnore |
||
36 | throw new ParserException('Failed To Parse MSGPack'); // @codeCoverageIgnore |
||
37 | } |
||
38 | |||
39 | set_error_handler($prevHandler); |
||
40 | |||
41 | return $msg; |
||
42 | } |
||
43 | 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.