wppaste
WordPress

Text_MappedDiff

Source
wp-includes/Text/Diff.php:271

Compatibility

WordPress
core
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Methods · 2

Source code

class Text_MappedDiff extends Text_Diff {     /**     * Computes a diff between sequences of strings.     *     * This can be used to compute things like case-insensitive diffs, or diffs     * which ignore changes in white-space.     *     * @param array $from_lines         An array of strings.     * @param array $to_lines           An array of strings.     * @param array $mapped_from_lines  This array should have the same size     *                                  number of elements as $from_lines.  The     *                                  elements in $mapped_from_lines and     *                                  $mapped_to_lines are what is actually     *                                  compared when computing the diff.     * @param array $mapped_to_lines    This array should have the same number     *                                  of elements as $to_lines.     */    function __construct($from_lines, $to_lines,                             $mapped_from_lines, $mapped_to_lines)    {        assert(count($from_lines) == count($mapped_from_lines));        assert(count($to_lines) == count($mapped_to_lines));         parent::Text_Diff($mapped_from_lines, $mapped_to_lines);         $xi = $yi = 0;        for ($i = 0; $i < count($this->_edits); $i++) {            $orig = &$this->_edits[$i]->orig;            if (is_array($orig)) {                $orig = array_slice($from_lines, $xi, count($orig));                $xi += count($orig);            }             $final = &$this->_edits[$i]->final;            if (is_array($final)) {                $final = array_slice($to_lines, $yi, count($final));                $yi += count($final);            }        }    } 	/**	 * 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 );	} }

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/Text/Diff.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.