class Diff
Class representing a 'diff' between two sequences of strings.
Component code originally taken from https://www.drupal.org/project/diff which was itself based on the PHP diff engine for phpwiki. The original code in phpwiki was copyright (C) 2000, 2001 Geoffrey T. Dairiki <dairiki@dairiki.org> and licensed under GPL.
Hierarchy
- class \Drupal\Component\Diff\Diff
 
Expanded class hierarchy of Diff
3 files declare their use of Diff
- AssertConfigTrait.php in core/
tests/ Drupal/ KernelTests/ AssertConfigTrait.php  - ConfigManager.php in core/
lib/ Drupal/ Core/ Config/ ConfigManager.php  - DiffFormatterTest.php in core/
tests/ Drupal/ Tests/ Component/ Diff/ DiffFormatterTest.php  
11 string references to 'Diff'
- CodeBlock::defaultConfiguration in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ CodeBlock.php  - Gets default configuration for this plugin.
 - CodeBlock::defaultConfiguration in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ CodeBlock.php  - Gets default configuration for this plugin.
 - ConfigurablePluginTest::testDefaults in core/
modules/ ckeditor5/ tests/ src/ Kernel/ ConfigurablePluginTest.php  - Tests default settings for configurable CKEditor 5 plugins.
 - ConfigurablePluginTest::testDefaults in core/
modules/ ckeditor5/ tests/ src/ Kernel/ ConfigurablePluginTest.php  - Tests default settings for configurable CKEditor 5 plugins.
 - editor.editor.full_html.yml in core/
profiles/ standard/ config/ install/ editor.editor.full_html.yml  - core/profiles/standard/config/install/editor.editor.full_html.yml
 
File
- 
              core/
lib/ Drupal/ Component/ Diff/ Diff.php, line 15  
Namespace
Drupal\Component\DiffView source
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;
  }
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overrides | 
|---|---|---|---|---|
| Diff::$edits | protected | property | The list of differences as an array of diff operations. | |
| Diff::getEdits | public | function | Gets the list of differences as an array of diff operations. | |
| Diff::__construct | public | function | Constructor. Computes diff between sequences of strings.  | 
                                                                                        1 | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.