You are here

protected function Twig_Error::updateRepr in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Error.php \Twig_Error::updateRepr()
4 calls to Twig_Error::updateRepr()
Twig_Error::guess in vendor/Twig/Error.php
Twig_Error::setTemplateFile in vendor/Twig/Error.php
Sets the filename where the error occurred.
Twig_Error::setTemplateLine in vendor/Twig/Error.php
Sets the template line where the error occurred.
Twig_Error::__construct in vendor/Twig/Error.php
Constructor.

File

vendor/Twig/Error.php, line 158

Class

Twig_Error
Twig base exception.

Code

protected function updateRepr() {
  $this->message = $this->rawMessage;
  $dot = false;
  if ('.' === substr($this->message, -1)) {
    $this->message = substr($this->message, 0, -1);
    $dot = true;
  }
  if ($this->filename) {
    if (is_string($this->filename) || is_object($this->filename) && method_exists($this->filename, '__toString')) {
      $filename = sprintf('"%s"', $this->filename);
    }
    else {
      $filename = json_encode($this->filename);
    }
    $this->message .= sprintf(' in %s', $filename);
  }
  if ($this->lineno && $this->lineno >= 0) {
    $this->message .= sprintf(' at line %d', $this->lineno);
  }
  if ($dot) {
    $this->message .= '.';
  }
}