Remove all the {{{ and }}} folding
This commit is contained in:
@@ -44,7 +44,6 @@ class Xdiff
|
||||
* @param string $output The output mode [Normal|Unified|SideBySide]
|
||||
*/
|
||||
public function __construct ($output = "normal")
|
||||
// {{{
|
||||
{
|
||||
if (! method_exists ($this, "display".ucfirst ($output)))
|
||||
throw new \Exception ("Invalid output requested to xdiff", 406);
|
||||
@@ -52,13 +51,11 @@ class Xdiff
|
||||
$this->file1Time = date ("Y-m-d H:i:s.u000 O");
|
||||
$this->file2Time = date ("Y-m-d H:i:s.u001 O");
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Allow to set the side by side width to the maximum allowed by screenWidth
|
||||
* @param integer $screenWidth The maximum width of the screen
|
||||
*/
|
||||
public function setScreenWidth ($screenWidth)
|
||||
// {{{
|
||||
{
|
||||
for ($x = 20 ; $x > 0 ; $x--)
|
||||
{
|
||||
@@ -70,14 +67,12 @@ class Xdiff
|
||||
}
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Compute the differences between two strings $string1 and $string2
|
||||
* @param string $string1 The first string to compare
|
||||
* @param string $string2 The second string to compare
|
||||
*/
|
||||
public function diff ($string1, $string2)
|
||||
// {{{
|
||||
{
|
||||
if (! is_string ($string1))
|
||||
throw new \Exception (
|
||||
@@ -91,14 +86,12 @@ class Xdiff
|
||||
preg_split ("#(.*\\R)#", $string2, -1,
|
||||
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY));
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Compute the differences between two files $file1 and $file2
|
||||
* @param string $file1 The first file to use to compare
|
||||
* @param string $file2 The second file to use to compare
|
||||
*/
|
||||
public function diffFile ($file1, $file2)
|
||||
// {{{
|
||||
{
|
||||
if (! is_string ($file1))
|
||||
throw new \Exception (
|
||||
@@ -127,20 +120,17 @@ class Xdiff
|
||||
return $this->diff (file_get_contents ($file1),
|
||||
file_get_contents ($file2));
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Compute the differences between two arrays $array1 and $array2
|
||||
* @param array $array1 The first array to compare
|
||||
* @param array $array2 The second array to compare
|
||||
*/
|
||||
public function diffArray ($array1, $array2)
|
||||
// {{{
|
||||
{
|
||||
$diff = $this->computeArray ($array1, $array2);
|
||||
$method = $this->output;
|
||||
return $this->$method ($diff);
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Compute the differences between two arrays $array1 and $array2
|
||||
* @param array $array1 The first array to compare
|
||||
@@ -148,7 +138,6 @@ class Xdiff
|
||||
* @return array The data in internal format
|
||||
*/
|
||||
final public function computeArray ($array1, $array2)
|
||||
// {{{
|
||||
{
|
||||
if (! is_array ($array1))
|
||||
throw new \Exception (
|
||||
@@ -267,14 +256,12 @@ class Xdiff
|
||||
}
|
||||
return $diff;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Return a string like "diff -u"
|
||||
* @param array $diffArray The diff array analyzed by diffArray method
|
||||
* @return string
|
||||
*/
|
||||
private function displayUnified ($diffArray)
|
||||
// {{{
|
||||
{
|
||||
$d = "";
|
||||
$i = 0 ;
|
||||
@@ -336,14 +323,12 @@ class Xdiff
|
||||
$e .= "+++ $this->filename2 $this->file2Time\n";
|
||||
return $e.$d;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Return a string like "diff" without parameter
|
||||
* @param array $diffArray The diff array analyzed by diffArray method
|
||||
* @return string
|
||||
*/
|
||||
private function displayNormal ($diffArray)
|
||||
// {{{
|
||||
{
|
||||
$d = "";
|
||||
$i = 0 ;
|
||||
@@ -383,14 +368,12 @@ class Xdiff
|
||||
}
|
||||
return $d;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Return a string like "diff -y" (Side by Side)
|
||||
* @param array $diffArray The diff array analyzed by diffArray method
|
||||
* @return string
|
||||
*/
|
||||
private function displaySideBySide ($diffArray)
|
||||
// {{{
|
||||
{
|
||||
$d = "";
|
||||
$i = 0 ;
|
||||
@@ -434,7 +417,6 @@ class Xdiff
|
||||
}
|
||||
return $d;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** Return a string sideBySide. Used by displaySideBySide for each line
|
||||
* @param string $side1 The string to be displayed on side1
|
||||
@@ -442,7 +424,6 @@ class Xdiff
|
||||
* @param string|null $symbol The symbol used to present the diff (<>|)
|
||||
*/
|
||||
private function side ($side1, $side2, $symbol = null)
|
||||
// {{{
|
||||
{
|
||||
$d = "";
|
||||
if (! is_string ($side1))
|
||||
@@ -478,7 +459,6 @@ class Xdiff
|
||||
$d .= "\n";
|
||||
return $d;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/** This function return the next common part between both arrays starting at
|
||||
* position $i for $array1 and $j for array2
|
||||
@@ -490,7 +470,6 @@ class Xdiff
|
||||
* @return string
|
||||
*/
|
||||
private function lcs ($array1, $array2, $i, $j)
|
||||
// {{{
|
||||
{
|
||||
$found1 = false;
|
||||
$found2 = false;
|
||||
@@ -530,5 +509,4 @@ class Xdiff
|
||||
}
|
||||
return $array1[$i];
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user