'Warning', LIBXML_ERR_ERROR => 'Error', LIBXML_ERR_FATAL => 'Fatal error', ); /** * Create validation error object * * @param string $message * @param mixed $error * @return void */ protected function __construct( $message, $error = null ) { $this->message = $message; $this->error = $error; } /** * Get original error object * * @return mixed */ public function getOriginalError() { return $this->error; } /** * Convert libXML error to string * * @return void */ public function __toString() { return $this->message; } /** * Create from LibXmlError * * Create a validation error object from a LibXmlError error object. * * @param LibXMLError $error * @return ezcDocumentValidationError */ public static function createFromLibXmlError( LibXMLError $error ) { return new ezcDocumentValidationError( sprintf( "%s in %d:%d: %s.", self::$errorTypes[$error->level], $error->line, $error->column, trim( $error->message ) ), $error ); } /** * Create validation error from Exception * * @param Exception $e * @return ezcDocumentValidationError */ public static function createFromException( Exception $e ) { return new ezcDocumentValidationError( $e->getMessage(), $e ); } } ?>