You are here

public function QueryPathParseException::__construct in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/QueryPath.php \QueryPathParseException::__construct()
  2. 7.2 QueryPath/QueryPath.php \QueryPathParseException::__construct()

File

QueryPath/QueryPath.php, line 2221

Class

QueryPathParseException

Code

public function __construct($msg = '', $code = 0, $file = NULL, $line = NULL) {
  $msgs = array();
  foreach (libxml_get_errors() as $err) {
    $format = $err->level == LIBXML_ERR_WARNING ? self::WARN_MSG_FORMAT : self::ERR_MSG_FORMAT;
    $msgs[] = sprintf($format, $err->file, $err->line, $err->column, $err->message, $err->code);
  }
  $msg .= implode("\n", $msgs);
  if (isset($file)) {
    $msg .= ' (' . $file;
    if (isset($line)) {
      $msg .= ': ' . $line;
    }
    $msg .= ')';
  }
  parent::__construct($msg, $code);
}