26 protected $htmlMessage;
28 public function __construct (
string $htmlMessage =
'',
int $code = 0, Throwable $previous = NULL)
30 $this->htmlMessage = $htmlMessage;
31 parent::__construct(
htmlunescape(strip_tags($htmlMessage)), $code, $previous);
34 public function getHtmlMessage ()
36 return $this->htmlMessage;
39 public function toArray (): array
42 'class' => get_class($this),
43 'message' => $this->getMessage(),
44 'line' => $this->getLine(),
45 'file' => $this->getFile(),
49 public function __toString ()
51 return $this->getMessage();
54 public function computeMsgDialogParameters (): array
56 return [_(
'Error'), $this->htmlMessage, ERROR_DIALOG, static::formatTrace($this)];
59 public function display ()
64 public static function formatTrace (Throwable $throwable): array
66 $trace = $throwable->getTrace();
68 foreach ($trace as &$traceStep) {
69 if (isset($traceStep[
'function']) && isset($traceStep[
'class']) && isset($traceStep[
'type'])) {
70 $traceStep[
'function'] = $traceStep[
'class'].$traceStep[
'type'].$traceStep[
'function'];
71 unset($traceStep[
'class']);
72 unset($traceStep[
'type']);
80 'file' => $throwable->getFile(),
81 'line' => $throwable->getLine(),
85 if ($previous = $throwable->getPrevious()) {
86 $trace[] = static::formatTrace($previous);
static display($title, string $message, int $type=INFO_DIALOG, array $trace=[])
Display a message dialog.
Parent class for all errors in FusionDirectory.
htmlunescape(string $html)
Unescape string for HTML output, reverse of htmlescape.