44
55namespace Jfcherng \Diff \Renderer \Text ;
66
7+ use Jfcherng \Diff \Differ ;
78use Jfcherng \Diff \SequenceMatcher ;
89
910/**
@@ -34,11 +35,11 @@ final class Context extends AbstractText
3435 /**
3536 * {@inheritdoc}
3637 */
37- protected function renderWoker (): string
38+ protected function renderWoker (Differ $ differ ): string
3839 {
3940 $ ret = '' ;
4041
41- foreach ($ this -> differ ->getGroupedOpcodes () as $ opcodes ) {
42+ foreach ($ differ ->getGroupedOpcodes () as $ opcodes ) {
4243 $ lastItem = \count ($ opcodes ) - 1 ;
4344
4445 $ i1 = $ opcodes [0 ][1 ];
@@ -49,9 +50,9 @@ protected function renderWoker(): string
4950 $ ret .=
5051 "*************** \n" .
5152 $ this ->renderBlockHeader ('* ' , $ i1 , $ i2 ) .
52- $ this ->renderBlockOld ($ opcodes ) .
53+ $ this ->renderBlockOld ($ opcodes, $ differ ) .
5354 $ this ->renderBlockHeader ('- ' , $ j1 , $ j2 ) .
54- $ this ->renderBlockNew ($ opcodes );
55+ $ this ->renderBlockNew ($ opcodes, $ differ );
5556 }
5657
5758 return $ ret ;
@@ -77,11 +78,12 @@ protected function renderBlockHeader(string $delimiter, int $a1, int $a2): strin
7778 /**
7879 * Render the old block.
7980 *
80- * @param array $opcodes the opcodes
81+ * @param array $opcodes the opcodes
82+ * @param Differ $differ the differ object
8183 *
8284 * @return string
8385 */
84- protected function renderBlockOld (array $ opcodes ): string
86+ protected function renderBlockOld (array $ opcodes, Differ $ differ ): string
8587 {
8688 $ ret = '' ;
8789
@@ -92,7 +94,7 @@ protected function renderBlockOld(array $opcodes): string
9294
9395 $ ret .= $ this ->renderContext (
9496 self ::TAG_MAP [$ tag ],
95- $ this -> differ ->getOld ($ i1 , $ i2 )
97+ $ differ ->getOld ($ i1 , $ i2 )
9698 );
9799 }
98100
@@ -102,11 +104,12 @@ protected function renderBlockOld(array $opcodes): string
102104 /**
103105 * Render the new block.
104106 *
105- * @param array $opcodes the opcodes
107+ * @param array $opcodes the opcodes
108+ * @param Differ $differ the differ object
106109 *
107110 * @return string
108111 */
109- protected function renderBlockNew (array $ opcodes ): string
112+ protected function renderBlockNew (array $ opcodes, Differ $ differ ): string
110113 {
111114 $ ret = '' ;
112115
@@ -117,7 +120,7 @@ protected function renderBlockNew(array $opcodes): string
117120
118121 $ ret .= $ this ->renderContext (
119122 self ::TAG_MAP [$ tag ],
120- $ this -> differ ->getNew ($ j1 , $ j2 )
123+ $ differ ->getNew ($ j1 , $ j2 )
121124 );
122125 }
123126
0 commit comments