Skip to content

Commit c9d5129

Browse files
committed
Run php-cs-fixer
1 parent 55c612c commit c9d5129

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

demo/demo_text.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
)
2424
);
2525
header('Content-Type: application/json');
26-
echo json_encode($demos);
26+
echo json_encode($demos);

demo/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
$data = json_decode($input, true);
2323
$diff = new HtmlDiff($data['oldText'], $data['newText'], 'UTF-8', array());
2424
$diff->build();
25-
25+
2626
header('Content-Type: application/json');
2727
echo json_encode(array('diff' => $diff->getDifference()));
2828
} else {

lib/Caxy/HtmlDiff/AbstractDiff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct($oldText, $newText, $encoding = 'UTF-8', $specialCas
3838
$this->setSpecialCaseTags($specialCaseTags);
3939
$this->setSpecialCaseChars(static::$defaultSpecialCaseChars);
4040
}
41-
41+
4242
public function setSpecialCaseChars(array $chars)
4343
{
4444
$this->specialCaseChars = $chars;
@@ -166,7 +166,7 @@ protected function purifyHtml($html, $tags = null)
166166
{
167167
if ( class_exists( 'Tidy' ) && false ) {
168168
$config = array( 'output-xhtml' => true, 'indent' => false );
169-
$tidy = new tidy;
169+
$tidy = new tidy();
170170
$tidy->parseString( $html, $config, 'utf8' );
171171
$html = (string) $tidy;
172172

lib/Caxy/HtmlDiff/HtmlDiff.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class HtmlDiff extends AbstractDiff
1111
protected $isolatedDiffTags = array ('ol' => '[[REPLACE_ORDERED_LIST]]', 'ul' => '[[REPLACE_UNORDERED_LIST]]', 'sub' => '[[REPLACE_SUB_SCRIPT]]' , 'sup' => '[[REPLACE_SUPER_SCRIPT]]', 'dl' => '[[REPLACE_DEFINITION_LIST]]', 'table' => '[[REPLACE_TABLE]]');
1212

1313
/**
14-
* @param boolean $boolean
14+
* @param boolean $boolean
1515
* @return HtmlDiff
1616
*/
1717
public function setInsertSpaceInReplace($boolean)
@@ -34,7 +34,7 @@ public function build()
3434
$this->splitInputsToWords();
3535
$this->replaceIsolatedDiffTags();
3636
$this->indexNewWords();
37-
37+
3838
$operations = $this->operations();
3939
foreach ($operations as $item) {
4040
$this->performOperation( $item );
@@ -78,9 +78,9 @@ protected function createIsolatedDiffTagPlaceholders(&$words)
7878
}
7979
$openIsolatedDiffTags++;
8080
$currentIsolatedDiffTag = $openIsolatedDiffTag;
81-
} elseif($openIsolatedDiffTags > 0 && $this->isClosingIsolatedDiffTag($word, $currentIsolatedDiffTag)) {
81+
} elseif ($openIsolatedDiffTags > 0 && $this->isClosingIsolatedDiffTag($word, $currentIsolatedDiffTag)) {
8282
$openIsolatedDiffTags--;
83-
if($openIsolatedDiffTags == 0){
83+
if ($openIsolatedDiffTags == 0) {
8484
$isolatedDiffTagIndicies[] = array ('start' => $isolatedDiffTagStart, 'length' => $index - $isolatedDiffTagStart + 1, 'tagType' => $currentIsolatedDiffTag);
8585
$currentIsolatedDiffTag = null;
8686
}
@@ -107,17 +107,19 @@ protected function isOpeningIsolatedDiffTag($item, $currentIsolatedDiffTag = nul
107107
return $key;
108108
}
109109
}
110+
110111
return false;
111112
}
112113

113114
protected function isClosingIsolatedDiffTag($item, $currentIsolatedDiffTag = null)
114115
{
115116
$tagsToMatch = $currentIsolatedDiffTag !== null ? array($currentIsolatedDiffTag => $this->isolatedDiffTags[$currentIsolatedDiffTag]) : $this->isolatedDiffTags;
116117
foreach ($tagsToMatch as $key => $value) {
117-
if (preg_match("#</".$key."[^>]*>\\s*#iU", $item)) {
118+
if (preg_match("#</".$key."[^>]*>\\s*#iU", $item)) {
118119
return $key;
119120
}
120121
}
122+
121123
return false;
122124
}
123125

@@ -152,7 +154,7 @@ protected function processInsertOperation($operation, $cssClass)
152154
$text = array();
153155
foreach ($this->newWords as $pos => $s) {
154156
if ($pos >= $operation->startInNew && $pos < $operation->endInNew) {
155-
if(in_array($s, $this->isolatedDiffTags) && isset($this->newIsolatedDiffTags[$pos])) {
157+
if (in_array($s, $this->isolatedDiffTags) && isset($this->newIsolatedDiffTags[$pos])) {
156158
foreach ($this->newIsolatedDiffTags[$pos] as $word) {
157159
$text[] = $word;
158160
}
@@ -195,6 +197,7 @@ protected function diffElements($oldText, $newText)
195197
$newText = preg_replace($pattern, '', $newText);
196198

197199
$diff = new HtmlDiff($oldText, $newText, $this->encoding, $this->isolatedDiffTags, $this->groupDiffs);
200+
198201
return $wrapStart . $diff->build() . $wrapEnd;
199202
}
200203

0 commit comments

Comments
 (0)