File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -42,20 +42,23 @@ public function toXML(TokenCollection $tokens): string {
4242
4343 $ iterator = $ tokens ->getIterator ();
4444 $ previousToken = $ iterator ->current ();
45+ $ previousLine = $ previousToken ->getLine ();
4546
4647 foreach ($ iterator as $ token ) {
47- if ($ previousToken ->getLine () < $ token ->getLine ()) {
48+ $ line = $ token ->getLine ();
49+ if ($ previousLine < $ line ) {
4850 $ writer ->endElement ();
4951
5052 $ writer ->startElement ('line ' );
51- $ writer ->writeAttribute ('no ' , (string )$ token -> getLine () );
52- $ previousToken = $ token ;
53+ $ writer ->writeAttribute ('no ' , (string )$ line );
54+ $ previousLine = $ line ;
5355 }
5456
55- if ($ token ->getValue () !== '' ) {
57+ $ value = $ token ->getValue ();
58+ if ($ value !== '' ) {
5659 $ writer ->startElement ('token ' );
5760 $ writer ->writeAttribute ('name ' , $ token ->getName ());
58- $ writer ->writeRaw (\htmlspecialchars ($ token -> getValue () , \ENT_NOQUOTES | \ENT_DISALLOWED | \ENT_XML1 ));
61+ $ writer ->writeRaw (\htmlspecialchars ($ value , \ENT_NOQUOTES | \ENT_DISALLOWED | \ENT_XML1 ));
5962 $ writer ->endElement ();
6063 }
6164 }
You can’t perform that action at this time.
0 commit comments