@@ -250,20 +250,33 @@ public function __destruct()
250
250
251
251
private function doDump ($ data , $ name , $ file , $ line )
252
252
{
253
- if ($ this ->dumper instanceof HtmlDumper) {
254
- $ name = $ this ->htmlEncode ($ name );
255
- $ file = $ this ->htmlEncode ($ file );
256
- if ('' !== $ file ) {
257
- if ($ this ->fileLinkFormat ) {
258
- $ link = strtr ($ this ->fileLinkFormat , array ('%f ' => $ file , '%l ' => $ line ));
259
- $ name = sprintf ('<a href="%s" title="%s">%s</a> ' , $ link , $ file , $ name );
253
+ if (PHP_VERSION_ID >= 50400 && $ this ->dumper instanceof CliDumper) {
254
+ $ contextDumper = function ($ name , $ file , $ line , $ fileLinkFormat ) {
255
+ if ($ this instanceof HtmlDumper) {
256
+ if ('' !== $ file ) {
257
+ $ s = $ this ->style ('meta ' , '%s ' );
258
+ $ name = strip_tags ($ this ->style ('' , $ name ));
259
+ $ file = strip_tags ($ this ->style ('' , $ file ));
260
+ if ($ fileLinkFormat ) {
261
+ $ link = strtr ($ fileLinkFormat , array ('%f ' => $ file , '%l ' => (int ) $ line ));
262
+ $ name = sprintf ('<a href="%s" title="%s"> ' .$ s .'</a> ' , $ link , $ file , $ name );
263
+ } else {
264
+ $ name = sprintf ('<abbr title="%s"> ' .$ s .'</abbr> ' , $ file , $ name );
265
+ }
266
+ } else {
267
+ $ name = $ this ->style ('meta ' , $ name );
268
+ }
269
+ $ this ->line = $ name .' on line ' .$ this ->style ('meta ' , $ line ).': ' ;
260
270
} else {
261
- $ name = sprintf ( ' <abbr title="%s">%s</abbr> ' , $ file , $ name ) ;
271
+ $ this -> line = $ this -> style ( ' meta ' , $ name ). ' on line ' . $ this -> style ( ' meta ' , $ line ). ' : ' ;
262
272
}
263
- }
264
- echo "\n<span class= \"sf-dump-meta \"> {$ name } on line {$ line }:</span> " ;
273
+ $ this ->dumpLine (0 );
274
+ };
275
+ $ contextDumper = $ contextDumper ->bindTo ($ this ->dumper , $ this ->dumper );
276
+ $ contextDumper ($ name , $ file , $ line , $ this ->fileLinkFormat );
265
277
} else {
266
- echo "{$ name } on line {$ line }: \n" ;
278
+ $ cloner = new VarCloner ();
279
+ $ this ->dumper ->dump ($ cloner ->cloneVar ($ name .' on line ' .$ line .': ' ));
267
280
}
268
281
$ this ->dumper ->dump ($ data );
269
282
}
0 commit comments