Text_Diff::__construct

Advertisement

Summery Summery

Computes diffs between sequences of strings.

Syntax Syntax

Text_Diff::__construct( string $engine, array $params )

Parameters Parameters

$engine

(Required) Name of the diffing engine to use. 'auto' will automatically select the best.

$params

(Required) Parameters to pass to the diffing engine. Normally an array of two arrays, each containing the lines from a file.

Source Source

File: wp-includes/Text/Diff.php

    function __construct( $engine, $params )
    {
        // Backward compatibility workaround.
        if (!is_string($engine)) {
            $params = array($engine, $params);
            $engine = 'auto';
        }

        if ($engine == 'auto') {
            $engine = extension_loaded('xdiff') ? 'xdiff' : 'native';
        } else {
            $engine = basename($engine);
        }

        // WP #7391
        require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php';
        $class = 'Text_Diff_Engine_' . $engine;
        $diff_engine = new $class();

        $this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
    }

Advertisement

Advertisement

Leave a Reply