Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. StrictUnifiedDiffOutputBuilder.php

function StrictUnifiedDiffOutputBuilder::__construct

File

vendor/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php, line 59

Class

StrictUnifiedDiffOutputBuilder
Strict Unified diff output builder.

Namespace

SebastianBergmann\Diff\Output

Code

public function __construct(array $options = []) {
    $options = array_merge(self::$default, $options);
    if (!is_bool($options['collapseRanges'])) {
        throw new ConfigurationException('collapseRanges', 'a bool', $options['collapseRanges']);
    }
    if (!is_int($options['contextLines']) || $options['contextLines'] < 0) {
        throw new ConfigurationException('contextLines', 'an int >= 0', $options['contextLines']);
    }
    if (!is_int($options['commonLineThreshold']) || $options['commonLineThreshold'] <= 0) {
        throw new ConfigurationException('commonLineThreshold', 'an int > 0', $options['commonLineThreshold']);
    }
    $this->assertString($options, 'fromFile');
    $this->assertString($options, 'toFile');
    $this->assertStringOrNull($options, 'fromFileDate');
    $this->assertStringOrNull($options, 'toFileDate');
    $this->header = sprintf("--- %s%s\n+++ %s%s\n", $options['fromFile'], null === $options['fromFileDate'] ? '' : "\t" . $options['fromFileDate'], $options['toFile'], null === $options['toFileDate'] ? '' : "\t" . $options['toFileDate']);
    $this->collapseRanges = $options['collapseRanges'];
    $this->commonLineThreshold = $options['commonLineThreshold'];
    $this->contextLines = $options['contextLines'];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal