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

Breadcrumb

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

function ConsoleSectionOutput::clear

Clears previous output for this section.

Parameters

int $lines Number of lines to clear. If null, then the entire output of this section is cleared:

1 call to ConsoleSectionOutput::clear()
ConsoleSectionOutput::overwrite in vendor/symfony/console/Output/ConsoleSectionOutput.php
Overwrites the previous output with a new message.

File

vendor/symfony/console/Output/ConsoleSectionOutput.php, line 64

Class

ConsoleSectionOutput
@author Pierre du Plessis <pdples@gmail.com> @author Gabriel Ostrolucký <gabriel.ostrolucky@gmail.com>

Namespace

Symfony\Component\Console\Output

Code

public function clear(?int $lines = null) : void {
    if (!$this->content || !$this->isDecorated()) {
        return;
    }
    if ($lines) {
        array_splice($this->content, -$lines);
    }
    else {
        $lines = $this->lines;
        $this->content = [];
    }
    $this->lines -= $lines;
    parent::doWrite($this->popStreamContentUntilCurrentSection($this->maxHeight ? min($this->maxHeight, $lines) : $lines), false);
}

API Navigation

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