Skip to content

Commit

Permalink
Merge pull request #4 from caxy/enhance-default_config_static_vars
Browse files Browse the repository at this point in the history
Added static properties for the default config variables
  • Loading branch information
mgersten-caxy committed Jul 31, 2014
2 parents 213afcc + bec5f2b commit 36fe885
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions lib/Caxy/HtmlDiff/HtmlDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

class HtmlDiff
{
public static $defaultSpecialCaseTags = array('strong', 'b', 'i', 'big', 'small', 'u', 'sub', 'sup', 'strike', 's', 'p');
public static $defaultSpecialCaseChars = array('.', ',', '(', ')', '\'');
public static $defaultGroupDiffs = true;

private $content;
private $oldText;
private $newText;
Expand All @@ -13,19 +17,27 @@ class HtmlDiff
private $encoding;
private $specialCaseOpeningTags = array();
private $specialCaseClosingTags = array();
private $specialCaseTags = array('strong', 'b', 'i', 'big', 'small', 'u', 'sub', 'sup', 'strike', 's', 'p');
private $specialCaseChars = array('.', ',', '(', ')', '\'');
private $groupDiffs = true;

public function __construct($oldText, $newText, $encoding = 'UTF-8', $specialCaseTags = array(), $groupDiffs = true)
{
private $specialCaseTags;
private $specialCaseChars;
private $groupDiffs;

public function __construct($oldText, $newText, $encoding = 'UTF-8', $specialCaseTags = null, $groupDiffs = null)
{
if ($specialCaseTags === null) {
$specialCaseTags = static::$defaultSpecialCaseTags;
}

if ($groupDiffs === null) {
$groupDiffs = static::$defaultGroupDiffs;
}

$this->oldText = $this->purifyHtml(trim($oldText));
$this->newText = $this->purifyHtml(trim($newText));
$this->encoding = $encoding;
$this->content = '';
$this->groupDiffs = $groupDiffs;

$this->setSpecialCaseTags($specialCaseTags);
$this->setSpecialCaseChars(static::$defaultSpecialCaseChars);
}

public function setSpecialCaseChars(array $chars)
Expand Down

0 comments on commit 36fe885

Please sign in to comment.