Total Complexity | 6 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | class ParseException extends \QueryPath\Exception |
||
18 | { |
||
19 | |||
20 | public const ERR_MSG_FORMAT = 'Parse error in %s on line %d column %d: %s (%d)'; |
||
21 | public const WARN_MSG_FORMAT = 'Parser warning in %s on line %d column %d: %s (%d)'; |
||
22 | |||
23 | // trigger_error |
||
24 | public function __construct($msg = '', $code = 0, $file = NULL, $line = NULL) |
||
25 | { |
||
26 | |||
27 | $msgs = []; |
||
28 | foreach (libxml_get_errors() as $err) { |
||
29 | $format = $err->level === LIBXML_ERR_WARNING ? self::WARN_MSG_FORMAT : self::ERR_MSG_FORMAT; |
||
30 | $msgs[] = sprintf($format, $err->file, $err->line, $err->column, $err->message, $err->code); |
||
31 | } |
||
32 | $msg .= implode("\n", $msgs); |
||
33 | |||
34 | if (isset($file)) { |
||
35 | $msg .= ' (' . $file; |
||
36 | if (isset($line)) { |
||
37 | $msg .= ': ' . $line; |
||
38 | } |
||
39 | $msg .= ')'; |
||
40 | } |
||
41 | |||
42 | parent::__construct($msg, $code); |
||
43 | } |
||
44 | |||
45 | public static function initializeFromError($code, $str, $file, $line, $cxt) |
||
50 | } |
||
51 | } |
||
52 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.