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

Breadcrumb

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

function Standard::pScalar_InterpolatedString

File

vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php, line 180

Class

Standard

Namespace

PhpParser\PrettyPrinter

Code

protected function pScalar_InterpolatedString(Scalar\InterpolatedString $node) : string {
    if ($node->getAttribute('kind') === Scalar\String_::KIND_HEREDOC) {
        $label = $node->getAttribute('docLabel');
        if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) {
            $nl = $this->phpVersion
                ->supportsFlexibleHeredoc() ? $this->nl : $this->newline;
            if (count($node->parts) === 1 && $node->parts[0] instanceof Node\InterpolatedStringPart && $node->parts[0]->value === '') {
                return "<<<{$label}{$nl}{$label}{$this->docStringEndToken}";
            }
            return "<<<{$label}{$nl}" . $this->pEncapsList($node->parts, null) . "{$nl}{$label}{$this->docStringEndToken}";
        }
    }
    return '"' . $this->pEncapsList($node->parts, '"') . '"';
}

API Navigation

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