function DiffFormatter::_lines

Same name in this branch
  1. main core/lib/Drupal/Core/Diff/DiffFormatter.php \Drupal\Core\Diff\DiffFormatter::_lines()
Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Diff/DiffFormatter.php \Drupal\Core\Diff\DiffFormatter::_lines()
  2. 11.x core/lib/Drupal/Component/Diff/DiffFormatter.php \Drupal\Component\Diff\DiffFormatter::_lines()
  3. 10 core/lib/Drupal/Core/Diff/DiffFormatter.php \Drupal\Core\Diff\DiffFormatter::_lines()
  4. 10 core/lib/Drupal/Component/Diff/DiffFormatter.php \Drupal\Component\Diff\DiffFormatter::_lines()
  5. 9 core/lib/Drupal/Core/Diff/DiffFormatter.php \Drupal\Core\Diff\DiffFormatter::_lines()
  6. 9 core/lib/Drupal/Component/Diff/DiffFormatter.php \Drupal\Component\Diff\DiffFormatter::_lines()
  7. 8.9.x core/lib/Drupal/Core/Diff/DiffFormatter.php \Drupal\Core\Diff\DiffFormatter::_lines()
  8. 8.9.x core/lib/Drupal/Component/Diff/DiffFormatter.php \Drupal\Component\Diff\DiffFormatter::_lines()

Format each line prefixed with the given character.

Parameters

string[] $lines: An array of lines.

string $prefix: The character to use when prefixing the lines (like '<' or '>'); defaults to ' '.

Return value

void No return value.

3 calls to DiffFormatter::_lines()
DiffFormatter::_added in core/lib/Drupal/Component/Diff/DiffFormatter.php
Format lines that have been added.
DiffFormatter::_context in core/lib/Drupal/Component/Diff/DiffFormatter.php
Format lines that provide context to the changed lines.
DiffFormatter::_deleted in core/lib/Drupal/Component/Diff/DiffFormatter.php
Format lines that have been deleted.
1 method overrides DiffFormatter::_lines()
DiffFormatter::_lines in core/lib/Drupal/Core/Diff/DiffFormatter.php
Format each line prefixed with the given character.

File

core/lib/Drupal/Component/Diff/DiffFormatter.php, line 255

Class

DiffFormatter
A class to format Diffs.

Namespace

Drupal\Component\Diff

Code

protected function _lines($lines, $prefix = ' ') {
  foreach ($lines as $line) {
    echo "{$prefix} {$line}\n";
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.