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

Breadcrumb

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

function Renderer::trimEmptyLine

Removes an empty line at the end of the given code, if present

Parameters

string $code Code:

Return value

string

1 call to Renderer::trimEmptyLine()
Renderer::renderStatementBlock in vendor/mck89/peast/lib/Peast/Renderer.php
Renders a node as a block statement

File

vendor/mck89/peast/lib/Peast/Renderer.php, line 1183

Class

Renderer
Nodes renderer class

Namespace

Peast

Code

protected function trimEmptyLine($code) {
    if ($this->renderOpts->nl) {
        $nl = preg_quote($this->renderOpts->nl, "/");
        $indent = preg_quote($this->getIndentation(), "/");
        $code = preg_replace("/{$nl}(?:{$indent})?\$/", "", $code);
    }
    return $code;
}

API Navigation

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