function DiffEngine::_line_hash

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Diff/Engine/DiffEngine.php \Drupal\Component\Diff\Engine\DiffEngine::_line_hash()
  2. 10 core/lib/Drupal/Component/Diff/Engine/DiffEngine.php \Drupal\Component\Diff\Engine\DiffEngine::_line_hash()

Returns the whole line if it's small enough, or a hash otherwise.

File

core/lib/Drupal/Component/Diff/Engine/DiffEngine.php, line 135

Class

DiffEngine
Class used internally by Diff to actually compute the diffs.

Namespace

Drupal\Component\Diff\Engine

Code

protected function _line_hash($line) {
    if (mb_strlen($line) > $this::MAX_XREF_LENGTH) {
        return hash('crc32b', $line);
    }
    else {
        return $line;
    }
}

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