Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Error.php

function Error::updateRepr

5 calls to Error::updateRepr()
Error::appendMessage in vendor/twig/twig/src/Error/Error.php
Error::guess in vendor/twig/twig/src/Error/Error.php
Error::setSourceContext in vendor/twig/twig/src/Error/Error.php
Error::setTemplateLine in vendor/twig/twig/src/Error/Error.php
Error::__construct in vendor/twig/twig/src/Error/Error.php
Constructor.

File

vendor/twig/twig/src/Error/Error.php, line 121

Class

Error
Twig base exception.

Namespace

Twig\Error

Code

private function updateRepr() : void {
    $this->message = $this->rawMessage;
    if ($this->sourcePath && $this->lineno > 0) {
        $this->file = $this->sourcePath;
        $this->line = $this->lineno;
        return;
    }
    $dot = false;
    if (str_ends_with($this->message, '.')) {
        $this->message = substr($this->message, 0, -1);
        $dot = true;
    }
    $questionMark = false;
    if (str_ends_with($this->message, '?')) {
        $this->message = substr($this->message, 0, -1);
        $questionMark = true;
    }
    if ($this->name) {
        if (\is_string($this->name) || $this->name instanceof \Stringable) {
            $name = \sprintf('"%s"', $this->name);
        }
        else {
            $name = json_encode($this->name);
        }
        $this->message .= \sprintf(' in %s', $name);
    }
    if ($this->lineno && $this->lineno >= 0) {
        $this->message .= \sprintf(' at line %d', $this->lineno);
    }
    if ($dot) {
        $this->message .= '.';
    }
    if ($questionMark) {
        $this->message .= '?';
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal