and licensed under GPL. */ class Diff { /** * The list of differences as an array of diff operations. * * @var \Drupal\Component\Diff\Engine\DiffOp[] */ protected $edits; /** * Constructor. * Computes diff between sequences of strings. * * @param array $from_lines * An array of strings. * (Typically these are lines from a file.) * @param array $to_lines * An array of strings. */ public function __construct($from_lines, $to_lines) { $diffOpBuilder = new DiffOpOutputBuilder(); $differ = new Differ($diffOpBuilder); $this->edits = $diffOpBuilder->toOpsArray($differ->diffToArray($from_lines, $to_lines)); } /** * Gets the list of differences as an array of diff operations. * * @return \Drupal\Component\Diff\Engine\DiffOp[] * The list of differences as an array of diff operations. */ public function getEdits() { return $this->edits; } }