Fix scrutinizer

This commit is contained in:
Laurent Destailleur
2022-06-12 11:17:11 +02:00
parent a62b5a10fe
commit 559ec051ab
6 changed files with 48 additions and 26 deletions

View File

@@ -12,6 +12,7 @@
/**
* A class containing functions for computing diffs and formatting the output.
* We can compare 2 strings or 2 files (as one string or line by line)
*/
class Diff
{
@@ -236,7 +237,7 @@ class Diff
* within 'span' elements, deletions are contained within 'del' elements, and
* insertions are contained within 'ins' elements. The parameters are:
*
* @param string $diff the diff array
* @param array $diff the diff array
* @param string $separator the separator between lines; this optional parameter defaults to '<br>'
* @return string HTML string
*/
@@ -275,7 +276,7 @@ class Diff
/**
* Returns a diff as an HTML table. The parameters are:
*
* @param string $diff the diff array
* @param array $diff the diff array
* @param string $indentation indentation to add to every line of the generated HTML; this optional parameter defaults to ''
* @param string $separator the separator between lines; this optional parameter defaults to '<br>'
* @return string HTML string
@@ -287,7 +288,8 @@ class Diff
// loop over the lines in the diff
$index = 0;
while ($index < count($diff)) {
$nbdiff = count($diff);
while ($index < $nbdiff) {
// determine the line type
switch ($diff[$index][1]) {
// display the content on the left and right
@@ -365,7 +367,7 @@ class Diff
* Returns the content of the cell, for use in the toTable function. The
* parameters are:
*
* @param string $diff the diff array
* @param array $diff the diff array
* @param string $indentation indentation to add to every line of the generated HTML
* @param string $separator the separator between lines
* @param string $index the current index, passes by reference