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

Breadcrumb

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

function Differ::getLinebreak

1 call to Differ::getLinebreak()
Differ::detectUnmatchedLineEndings in vendor/sebastian/diff/src/Differ.php

File

vendor/sebastian/diff/src/Differ.php, line 177

Class

Differ

Namespace

SebastianBergmann\Diff

Code

private function getLinebreak($line) : string {
    if (!is_string($line)) {
        return '';
    }
    $lc = substr($line, -1);
    if ("\r" === $lc) {
        return "\r";
    }
    if ("\n" !== $lc) {
        return '';
    }
    if (str_ends_with($line, "\r\n")) {
        return "\r\n";
    }
    return "\n";
}
RSS feed
Powered by Drupal