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

Breadcrumb

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

function PrettyPrinterAbstract::pComments

Prints reformatted text of the passed comments.

Parameters

Comment[] $comments List of comments:

Return value

string Reformatted text of comments

3 calls to PrettyPrinterAbstract::pComments()
PrettyPrinterAbstract::pArray in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php
Perform a format-preserving pretty print of an array.
PrettyPrinterAbstract::pCommaSeparatedMultiline in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php
Pretty prints a comma-separated list of nodes in multiline style, including comments.
PrettyPrinterAbstract::pStmts in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php
Pretty prints an array of nodes (statements) and indents them optionally.

File

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

Class

PrettyPrinterAbstract

Namespace

PhpParser

Code

protected function pComments(array $comments) : string {
    $formattedComments = [];
    foreach ($comments as $comment) {
        $formattedComments[] = str_replace("\n", $this->nl, $comment->getReformattedText());
    }
    return implode($this->nl, $formattedComments);
}

API Navigation

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