@@ -23,7 +23,9 @@ abstract class AbstractHtml extends AbstractRenderer
2323 const IS_TEXT_RENDERER = false ;
2424
2525 /**
26- * @var array array of the different opcode tags and how they map to the HTML class
26+ * @var array array of the different opcodes and how they are mapped to HTML classes
27+ *
28+ * @todo rename to OP_CLASS_MAP in v7
2729 */
2830 const TAG_CLASS_MAP = [
2931 SequenceMatcher::OP_DEL => 'del ' ,
@@ -64,27 +66,27 @@ public function getChanges(Differ $differ): array
6466
6567 foreach ($ differ ->getGroupedOpcodes () as $ opcodes ) {
6668 $ hunk = [];
67- $ lastTag = SequenceMatcher::OP_NOP ;
69+ $ lastOp = SequenceMatcher::OP_NOP ;
6870 $ lastBlock = 0 ;
6971
70- foreach ($ opcodes as [$ tag , $ i1 , $ i2 , $ j1 , $ j2 ]) {
72+ foreach ($ opcodes as [$ op , $ i1 , $ i2 , $ j1 , $ j2 ]) {
7173 if (
72- $ tag === SequenceMatcher::OP_REP &&
74+ $ op === SequenceMatcher::OP_REP &&
7375 $ i2 - $ i1 === $ j2 - $ j1
7476 ) {
7577 for ($ i = 0 ; $ i < $ i2 - $ i1 ; ++$ i ) {
7678 $ this ->renderChangedExtent ($ lineRenderer , $ old [$ i1 + $ i ], $ new [$ j1 + $ i ]);
7779 }
7880 }
7981
80- if ($ tag !== $ lastTag ) {
81- $ hunk [] = $ this ->getDefaultBlock ($ tag , $ i1 , $ j1 );
82+ if ($ op !== $ lastOp ) {
83+ $ hunk [] = $ this ->getDefaultBlock ($ op , $ i1 , $ j1 );
8284 $ lastBlock = \count ($ hunk ) - 1 ;
8385 }
8486
85- $ lastTag = $ tag ;
87+ $ lastOp = $ op ;
8688
87- if ($ tag === SequenceMatcher::OP_EQ ) {
89+ if ($ op === SequenceMatcher::OP_EQ ) {
8890 // note that although we are in a OP_EQ situation,
8991 // the old and the new may not be exactly the same
9092 // because of ignoreCase, ignoreWhitespace, etc
@@ -96,7 +98,7 @@ public function getChanges(Differ $differ): array
9698 continue ;
9799 }
98100
99- if ($ tag & (SequenceMatcher::OP_REP | SequenceMatcher::OP_DEL )) {
101+ if ($ op & (SequenceMatcher::OP_REP | SequenceMatcher::OP_DEL )) {
100102 $ lines = \array_slice ($ old , $ i1 , $ i2 - $ i1 );
101103 $ lines = $ this ->formatLines ($ lines );
102104 $ lines = \str_replace (
@@ -108,7 +110,7 @@ public function getChanges(Differ $differ): array
108110 $ hunk [$ lastBlock ]['old ' ]['lines ' ] = $ lines ;
109111 }
110112
111- if ($ tag & (SequenceMatcher::OP_REP | SequenceMatcher::OP_INS )) {
113+ if ($ op & (SequenceMatcher::OP_REP | SequenceMatcher::OP_INS )) {
112114 $ lines = \array_slice ($ new , $ j1 , $ j2 - $ j1 );
113115 $ lines = $ this ->formatLines ($ lines );
114116 $ lines = \str_replace (
@@ -182,16 +184,18 @@ protected function renderChangedExtent(AbstractLineRenderer $lineRenderer, strin
182184 /**
183185 * Get the default block.
184186 *
185- * @param int $tag the operation tag
186- * @param int $i1 begin index of the diff of the old array
187- * @param int $j1 begin index of the diff of the new array
187+ * @param int $op the operation
188+ * @param int $i1 begin index of the diff of the old array
189+ * @param int $j1 begin index of the diff of the new array
188190 *
189191 * @return array the default block
192+ *
193+ * @todo rename tag to op in v7
190194 */
191- protected function getDefaultBlock (int $ tag , int $ i1 , int $ j1 ): array
195+ protected function getDefaultBlock (int $ op , int $ i1 , int $ j1 ): array
192196 {
193197 return [
194- 'tag ' => $ tag ,
198+ 'tag ' => $ op ,
195199 'old ' => [
196200 'offset ' => $ i1 ,
197201 'lines ' => [],
0 commit comments