Passed
Push — master ( ddbfa4...e1019e )
by Josh
03:27
created
lib/Caxy/HtmlDiff/ListDiff.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -505,6 +505,7 @@  discard block
 block discarded – undo
505 505
      * @param string $oldList
506 506
      * @param array $match
507 507
      * @param array $index
508
+     * @param string $type
508 509
      * @return string
509 510
      */
510 511
     protected function addListElementToContent($newList, $oldList, array $match, array $index, $type)
@@ -588,7 +589,7 @@  discard block
 block discarded – undo
588 589
     /**
589 590
      * Converts the list (li) content arrays to string.
590 591
      *
591
-     * @param array $listContentArray
592
+     * @param string $listContentArray
592 593
      * @return string
593 594
      */
594 595
     protected function convertListContentArrayToString($listContentArray)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -371,7 +371,7 @@
 block discarded – undo
371 371
                         $columns = $this->getArrayColumn($bestMatchPercentages, $key);
372 372
                         $thisBestMatches = array_filter(
373 373
                             $columns,
374
-                            function ($v) use ($percent) {
374
+                            function($v) use ($percent) {
375 375
                                 return $v > $percent;
376 376
                             }
377 377
                         );
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/ListDiff/DiffList.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
14 14
 
15 15
     protected $endTag;
16 16
 
17
+    /**
18
+     * @param null|string $listType
19
+     */
17 20
     public function __construct($listType, $startTag, $endTag, $listItems = array(), $attributes = array())
18 21
     {
19 22
         $this->listType = $listType;
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/ListDiffNew.php 1 patch
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -217,12 +217,18 @@  discard block
 block discarded – undo
217 217
         return $diffList;
218 218
     }
219 219
 
220
+    /**
221
+     * @param string $type
222
+     */
220 223
     protected function isOpeningListTag($word, $type = null)
221 224
     {
222 225
         $filter = $type !== null ? array('<' . $type) : array('<ul', '<ol', '<dl');
223 226
         return in_array(substr($word, 0, 3), $filter);
224 227
     }
225 228
 
229
+    /**
230
+     * @param string $type
231
+     */
226 232
     protected function isClosingListTag($word, $type = null)
227 233
     {
228 234
         $filter = $type !== null ? array('</' . $type) : array('</ul', '</ol', '</dl');
@@ -230,6 +236,9 @@  discard block
 block discarded – undo
230 236
         return in_array(substr($word, 0, 4), $filter);
231 237
     }
232 238
 
239
+    /**
240
+     * @param string $type
241
+     */
233 242
     protected function isOpeningListItemTag($word, $type = null)
234 243
     {
235 244
         $filter = $type !== null ? array('<' . $type) : array('<li', '<dd', '<dt');
@@ -237,6 +246,9 @@  discard block
 block discarded – undo
237 246
         return in_array(substr($word, 0, 3), $filter);
238 247
     }
239 248
 
249
+    /**
250
+     * @param string $type
251
+     */
240 252
     protected function isClosingListItemTag($word, $type = null)
241 253
     {
242 254
         $filter = $type !== null ? array('</' . $type) : array('</li', '</dd', '</dt');
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/Match.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -8,6 +8,10 @@
 block discarded – undo
8 8
     public $startInNew;
9 9
     public $size;
10 10
 
11
+    /**
12
+     * @param integer $startInOld
13
+     * @param integer $size
14
+     */
11 15
     public function __construct($startInOld, $startInNew, $size)
12 16
     {
13 17
         $this->startInOld = $startInOld;
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/Table/TableDiff.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 
230 230
     /**
231 231
      * @param Operation $operation
232
-     * @param array     $oldRows
233
-     * @param array     $newRows
232
+     * @param TableRow[]     $oldRows
233
+     * @param TableRow[]     $newRows
234 234
      * @param array     $appliedRowSpans
235 235
      */
236 236
     protected function processEqualOperation(Operation $operation, $oldRows, $newRows, &$appliedRowSpans)
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 
250 250
     /**
251 251
      * @param Operation $operation
252
-     * @param array     $oldRows
253
-     * @param array     $newRows
252
+     * @param TableRow[]     $oldRows
253
+     * @param TableRow[]     $newRows
254 254
      * @param array     $appliedRowSpans
255 255
      */
256 256
     protected function processReplaceOperation(Operation $operation, $oldRows, $newRows, &$appliedRowSpans)
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/HtmlDiffConfig.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
     /**
96 96
      * @param int $matchThreshold
97 97
      *
98
-     * @return AbstractDiff
98
+     * @return HtmlDiffConfig
99 99
      */
100 100
     public function setMatchThreshold($matchThreshold)
101 101
     {
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/HtmlDiff.php 2 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -387,6 +387,12 @@  discard block
 block discarded – undo
387 387
         return $diff->build();
388 388
     }
389 389
 
390
+    /**
391
+     * @param string $oldText
392
+     * @param string $newText
393
+     * @param string $attribute
394
+     * @param string $element
395
+     */
390 396
     protected function diffElementsByAttribute($oldText, $newText, $attribute, $element)
391 397
     {
392 398
         $oldAttribute = $this->getAttributeFromTag($oldText, $attribute);
@@ -662,7 +668,7 @@  discard block
 block discarded – undo
662 668
     /**
663 669
      * @param string $item
664 670
      *
665
-     * @return bool
671
+     * @return integer
666 672
      */
667 673
     protected function isOpeningTag($item)
668 674
     {
@@ -672,7 +678,7 @@  discard block
 block discarded – undo
672 678
     /**
673 679
      * @param string $item
674 680
      *
675
-     * @return bool
681
+     * @return integer
676 682
      */
677 683
     protected function isClosingTag($item)
678 684
     {
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
             if ($this->isTag($word)) {
121 121
                 $word = $this->stripTagAttributes($word);
122 122
             }
123
-            if (isset($this->wordIndices[ $word ])) {
124
-                $this->wordIndices[ $word ][] = $i;
123
+            if (isset($this->wordIndices[$word])) {
124
+                $this->wordIndices[$word][] = $i;
125 125
             } else {
126
-                $this->wordIndices[ $word ] = array($i);
126
+                $this->wordIndices[$word] = array($i);
127 127
             }
128 128
         }
129 129
     }
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
             } else {
540 540
                 $firstOrDefault = false;
541 541
                 foreach ($this->config->getSpecialCaseOpeningTags() as $x) {
542
-                    if (preg_match($x, $words[ 0 ])) {
542
+                    if (preg_match($x, $words[0])) {
543 543
                         $firstOrDefault = $x;
544 544
                         break;
545 545
                     }
@@ -547,13 +547,13 @@  discard block
 block discarded – undo
547 547
                 if ($firstOrDefault) {
548 548
                     $specialCaseTagInjection = '<ins class="mod">';
549 549
                     if ($tag == 'del') {
550
-                        unset($words[ 0 ]);
550
+                        unset($words[0]);
551 551
                     }
552
-                } elseif (array_search($words[ 0 ], $this->config->getSpecialCaseClosingTags()) !== false) {
552
+                } elseif (array_search($words[0], $this->config->getSpecialCaseClosingTags()) !== false) {
553 553
                     $specialCaseTagInjection = '</ins>';
554 554
                     $specialCaseTagInjectionIsBefore = true;
555 555
                     if ($tag == 'del') {
556
-                        unset($words[ 0 ]);
556
+                        unset($words[0]);
557 557
                     }
558 558
                 }
559 559
             }
@@ -564,12 +564,12 @@  discard block
 block discarded – undo
564 564
                 $this->content .= $specialCaseTagInjection.implode('', $this->extractConsecutiveWords($words, 'tag'));
565 565
             } else {
566 566
                 $workTag = $this->extractConsecutiveWords($words, 'tag');
567
-                if (isset($workTag[ 0 ]) && $this->isOpeningTag($workTag[ 0 ]) && !$this->isClosingTag($workTag[ 0 ])) {
568
-                    if (strpos($workTag[ 0 ], 'class=')) {
569
-                        $workTag[ 0 ] = str_replace('class="', 'class="diffmod ', $workTag[ 0 ]);
570
-                        $workTag[ 0 ] = str_replace("class='", 'class="diffmod ', $workTag[ 0 ]);
567
+                if (isset($workTag[0]) && $this->isOpeningTag($workTag[0]) && !$this->isClosingTag($workTag[0])) {
568
+                    if (strpos($workTag[0], 'class=')) {
569
+                        $workTag[0] = str_replace('class="', 'class="diffmod ', $workTag[0]);
570
+                        $workTag[0] = str_replace("class='", 'class="diffmod ', $workTag[0]);
571 571
                     } else {
572
-                        $workTag[ 0 ] = str_replace('>', ' class="diffmod">', $workTag[ 0 ]);
572
+                        $workTag[0] = str_replace('>', ' class="diffmod">', $workTag[0]);
573 573
                     }
574 574
                 }
575 575
 
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
     {
755 755
         $word = explode(' ', trim($word, '<>'));
756 756
 
757
-        return '<'.$word[ 0 ].'>';
757
+        return '<'.$word[0].'>';
758 758
     }
759 759
 
760 760
     /**
@@ -773,23 +773,23 @@  discard block
 block discarded – undo
773 773
         $matchLengthAt = array();
774 774
         for ($indexInOld = $startInOld; $indexInOld < $endInOld; ++$indexInOld) {
775 775
             $newMatchLengthAt = array();
776
-            $index = $this->oldWords[ $indexInOld ];
776
+            $index = $this->oldWords[$indexInOld];
777 777
             if ($this->isTag($index)) {
778 778
                 $index = $this->stripTagAttributes($index);
779 779
             }
780
-            if (!isset($this->wordIndices[ $index ])) {
780
+            if (!isset($this->wordIndices[$index])) {
781 781
                 $matchLengthAt = $newMatchLengthAt;
782 782
                 continue;
783 783
             }
784
-            foreach ($this->wordIndices[ $index ] as $indexInNew) {
784
+            foreach ($this->wordIndices[$index] as $indexInNew) {
785 785
                 if ($indexInNew < $startInNew) {
786 786
                     continue;
787 787
                 }
788 788
                 if ($indexInNew >= $endInNew) {
789 789
                     break;
790 790
                 }
791
-                $newMatchLength = (isset($matchLengthAt[ $indexInNew - 1 ]) ? $matchLengthAt[ $indexInNew - 1 ] : 0) + 1;
792
-                $newMatchLengthAt[ $indexInNew ] = $newMatchLength;
791
+                $newMatchLength = (isset($matchLengthAt[$indexInNew - 1]) ? $matchLengthAt[$indexInNew - 1] : 0) + 1;
792
+                $newMatchLengthAt[$indexInNew] = $newMatchLength;
793 793
                 if ($newMatchLength > $bestMatchSize ||
794 794
                     (
795 795
                         $this->isGroupDiffs() &&
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/AbstractDiff.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -319,7 +319,7 @@
 block discarded – undo
319 319
     {
320 320
         $expStr = explode($start, $str, 2);
321 321
         if (count($expStr) > 1) {
322
-            $expStr = explode($end, $expStr[ 1 ]);
322
+            $expStr = explode($end, $expStr[1]);
323 323
             if (count($expStr) > 1) {
324 324
                 array_pop($expStr);
325 325
 
Please login to merge, or discard this patch.