You are here

protected function Twig_Error::updateRepr in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Error.php \Twig_Error::updateRepr()

@internal

5 calls to Twig_Error::updateRepr()
Twig_Error::appendMessage in vendor/twig/twig/lib/Twig/Error.php
Twig_Error::guess in vendor/twig/twig/lib/Twig/Error.php
Twig_Error::setTemplateFile in vendor/twig/twig/lib/Twig/Error.php
Sets the filename where the error occurred.
Twig_Error::setTemplateLine in vendor/twig/twig/lib/Twig/Error.php
Sets the template line where the error occurred.
Twig_Error::__construct in vendor/twig/twig/lib/Twig/Error.php
Constructor.

File

vendor/twig/twig/lib/Twig/Error.php, line 167

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;
  }
  $questionMark = false;
  if ('?' === substr($this->message, -1)) {
    $this->message = substr($this->message, 0, -1);
    $questionMark = 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 .= '.';
  }
  if ($questionMark) {
    $this->message .= '?';
  }
}