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

Breadcrumb

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

function PrettyPrinterAbstract::pStmts

Pretty prints an array of nodes (statements) and indents them optionally.

Parameters

Node[] $nodes Array of nodes:

bool $indent Whether to indent the printed nodes:

Return value

string Pretty printed statements

28 calls to PrettyPrinterAbstract::pStmts()
PrettyPrinterAbstract::prettyPrint in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php
Pretty prints an array of statements.
PrettyPrinterAbstract::printFormatPreserving in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php
Perform a format-preserving pretty print of an AST.
Standard::pClassCommon in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php
Standard::pExpr_Closure in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php
Standard::pParam in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php

... See full list

File

vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php, line 348

Class

PrettyPrinterAbstract

Namespace

PhpParser

Code

protected function pStmts(array $nodes, bool $indent = true) : string {
    if ($indent) {
        $this->indent();
    }
    $result = '';
    foreach ($nodes as $node) {
        $comments = $node->getComments();
        if ($comments) {
            $result .= $this->nl . $this->pComments($comments);
            if ($node instanceof Stmt\Nop) {
                continue;
            }
        }
        $result .= $this->nl . $this->p($node);
    }
    if ($indent) {
        $this->outdent();
    }
    return $result;
}

API Navigation

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