* Normally an array of two arrays, each
* containing the lines from a file.
*/
- function Text_Diff($engine, $params)
+ function __construct( $engine, $params )
{
// Backward compatibility workaround.
if (!is_string($engine)) {
$this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
}
+ /**
+ * PHP4 constructor.
+ */
+ public function Text_Diff( $engine, $params ) {
+ self::__construct( $engine, $params );
+ }
+
/**
* Returns the array of differences.
*/
* @param string $line The line to trim.
* @param integer $key The index of the line in the array. Not used.
*/
- function trimNewlines(&$line, $key)
+ static function trimNewlines(&$line, $key)
{
$line = str_replace(array("\n", "\r"), '', $line);
}
* @param array $mapped_to_lines This array should have the same number
* of elements as $to_lines.
*/
- function Text_MappedDiff($from_lines, $to_lines,
+ function __construct($from_lines, $to_lines,
$mapped_from_lines, $mapped_to_lines)
{
assert(count($from_lines) == count($mapped_from_lines));
}
}
+ /**
+ * PHP4 constructor.
+ */
+ public function Text_MappedDiff( $from_lines, $to_lines,
+ $mapped_from_lines, $mapped_to_lines ) {
+ self::__construct( $from_lines, $to_lines,
+ $mapped_from_lines, $mapped_to_lines );
+ }
+
}
/**
*/
class Text_Diff_Op_copy extends Text_Diff_Op {
- function Text_Diff_Op_copy($orig, $final = false)
+ /**
+ * PHP5 constructor.
+ */
+ function __construct( $orig, $final = false )
{
if (!is_array($final)) {
$final = $orig;
$this->final = $final;
}
+ /**
+ * PHP4 constructor.
+ */
+ public function Text_Diff_Op_copy( $orig, $final = false ) {
+ self::__construct( $orig, $final );
+ }
+
function &reverse()
{
- $reverse = &new Text_Diff_Op_copy($this->final, $this->orig);
+ $reverse = new Text_Diff_Op_copy($this->final, $this->orig);
return $reverse;
}
*/
class Text_Diff_Op_delete extends Text_Diff_Op {
- function Text_Diff_Op_delete($lines)
+ /**
+ * PHP5 constructor.
+ */
+ function __construct( $lines )
{
$this->orig = $lines;
$this->final = false;
}
+ /**
+ * PHP4 constructor.
+ */
+ public function Text_Diff_Op_delete( $lines ) {
+ self::__construct( $lines );
+ }
+
function &reverse()
{
- $reverse = &new Text_Diff_Op_add($this->orig);
+ $reverse = new Text_Diff_Op_add($this->orig);
return $reverse;
}
*/
class Text_Diff_Op_add extends Text_Diff_Op {
- function Text_Diff_Op_add($lines)
+ /**
+ * PHP5 constructor.
+ */
+ function __construct( $lines )
{
$this->final = $lines;
$this->orig = false;
}
+ /**
+ * PHP4 constructor.
+ */
+ public function Text_Diff_Op_add( $lines ) {
+ self::__construct( $lines );
+ }
+
function &reverse()
{
- $reverse = &new Text_Diff_Op_delete($this->final);
+ $reverse = new Text_Diff_Op_delete($this->final);
return $reverse;
}
*/
class Text_Diff_Op_change extends Text_Diff_Op {
- function Text_Diff_Op_change($orig, $final)
+ /**
+ * PHP5 constructor.
+ */
+ function __construct( $orig, $final )
{
$this->orig = $orig;
$this->final = $final;
}
+ /**
+ * PHP4 constructor.
+ */
+ public function Text_Diff_Op_change( $orig, $final ) {
+ self::__construct( $orig, $final );
+ }
+
function &reverse()
{
- $reverse = &new Text_Diff_Op_change($this->final, $this->orig);
+ $reverse = new Text_Diff_Op_change($this->final, $this->orig);
return $reverse;
}