You are here

class DiffFormatter in Diff 8

Diff formatter which returns output that can be rendered to a table.

Hierarchy

Expanded class hierarchy of DiffFormatter

1 string reference to 'DiffFormatter'
diff.services.yml in ./diff.services.yml
diff.services.yml
1 service uses DiffFormatter
diff.diff.formatter in ./diff.services.yml
Drupal\diff\DiffFormatter

File

src/DiffFormatter.php, line 11

Namespace

Drupal\diff
View source
class DiffFormatter extends CoreDiffFormatterBase {

  /**
   * Creates a DiffFormatter to render diffs in a table.
   *
   * We need to extend the constructor of the diff formatter used by the
   * core config system in order to provide our own settings.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   */
  public function __construct(ConfigFactoryInterface $config_factory) {
    parent::__construct($config_factory);
    $config = $config_factory
      ->get('diff.settings');
    $this->leading_context_lines = $config
      ->get('general_settings.context_lines_leading');
    $this->trailing_context_lines = $config
      ->get('general_settings.context_lines_trailing');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DiffFormatter::$leading_context_lines public property Number of leading context "lines" to preserve.
DiffFormatter::$line_stats protected property The line stats.
DiffFormatter::$rows protected property The diff represented as an array of rows.
DiffFormatter::$show_header public property Should a block header be shown?
DiffFormatter::$trailing_context_lines public property Number of trailing context "lines" to preserve.
DiffFormatter::addedLine protected function Creates an added line.
DiffFormatter::contextLine protected function Creates a context line.
DiffFormatter::deletedLine protected function Creates a deleted line.
DiffFormatter::emptyLine protected function Creates an empty line.
DiffFormatter::format public function Format a diff.
DiffFormatter::_added protected function Overrides DiffFormatter::_added
DiffFormatter::_block protected function
DiffFormatter::_block_header protected function Overrides DiffFormatter::_block_header
DiffFormatter::_changed protected function Overrides DiffFormatter::_changed
DiffFormatter::_context protected function Overrides DiffFormatter::_context
DiffFormatter::_deleted protected function Overrides DiffFormatter::_deleted
DiffFormatter::_end_block protected function
DiffFormatter::_end_diff protected function Overrides DiffFormatter::_end_diff
DiffFormatter::_lines protected function Overrides DiffFormatter::_lines
DiffFormatter::_start_block protected function Overrides DiffFormatter::_start_block
DiffFormatter::_start_diff protected function Overrides DiffFormatter::_start_diff
DiffFormatter::__construct public function Creates a DiffFormatter to render diffs in a table. Overrides DiffFormatter::__construct