First off I must say that the indentation is quite inconsistent and makes reading this code challenging. While most of the inconsistencies appear to be indentation on braces, the indentation on comments also seems a bit wonky. While I don't adhere to everything in it, I suggest following PSR-2 - especially using 4 spaces for indentation.
One thing I observed in the sample usage code is that $file
and $line
are NULL
. Perhaps you were intending to use those from the array $error
.
To avoid the need to escape double quotes in the HTML, you could use a different delimiting method like heredoc or nowdoc. And perhaps it would be simpler to move the styles into CSS.