1 <?php
2 
3 namespace Sabre\Xml;
4 
5 use
6     LibXMLError;
7 
8 /**
9  * This exception is thrown when the Readers runs into a parsing error.
10  *
11  * This exception effectively wraps 1 or more LibXMLError objects.
12  *
13  * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
14  * @author Evert Pot (http://evertpot.com/)
15  * @license http://sabre.io/license/ Modified BSD License
16  */
17 class LibXMLException extends ParseException {
18 
19     /**
20      * The error list.
21      *
22      * @var LibXMLError[]
23      */
24     protected $errors;
25 
26     /**
27      * Creates the exception.
28      *
29      * You should pass a list of LibXMLError objects in its constructor.
30      *
31      * @param LibXMLError[] $errors
32      * @param int $code
33      * @param Exception $previousException
34      */
35     function __construct(array $errors, $code = null, Exception $previousException = null) {
36 
37         $this->errors = $errors;
38         parent::__construct($errors[0]->message . ' on line ' . $errors[0]->line . ', column ' . $errors[0]->column, $code, $previousException);
39 
40     }
41 
42     /**
43      * Returns the LibXML errors
44      *
45      * @return void
46      */
47     function getErrors() {
48 
49         return $this->errors;
50 
51     }
52 
53 }
54