44 parent::__construct($this->message, 0, $previous);
120 if (
'.' === substr($this->message, -1)) {
121 $this->message = substr($this->message, 0, -1);
125 if (null !== $this->parsedFile) {
126 $this->message .= sprintf(
' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
129 if ($this->parsedLine >= 0) {
130 $this->message .= sprintf(
' at line %d', $this->parsedLine);
133 if ($this->snippet) {
134 $this->message .= sprintf(
' (near "%s")', $this->snippet);
138 $this->message .=
'.';
setSnippet($snippet)
Sets the snippet of code near the error.
__construct($message, $parsedLine=-1, $snippet=null, $parsedFile=null, \Exception $previous=null)
Constructor.
setParsedFile($parsedFile)
Sets the filename where the error occurred.
catch(Exception $e) $message
getParsedLine()
Gets the line where the error occurred.
getParsedFile()
Gets the filename where the error occurred.
Exception class thrown when an error occurs during parsing.
getSnippet()
Gets the snippet of code near the error.
setParsedLine($parsedLine)
Sets the line where the error occurred.