@@ -54,9 +54,9 @@ class CliDumper extends AbstractDumper
54
54
/**
55
55
* {@inheritdoc}
56
56
*/
57
- public function __construct ($ output = null , $ charset = null )
57
+ public function __construct ($ output = null , $ charset = null , $ flags = 0 )
58
58
{
59
- parent ::__construct ($ output , $ charset );
59
+ parent ::__construct ($ output , $ charset, $ flags );
60
60
61
61
if ('\\' === DIRECTORY_SEPARATOR && false !== @getenv ('ANSICON ' )) {
62
62
// Use only the base 16 xterm colors when using ANSICON
@@ -180,6 +180,9 @@ public function dumpString(Cursor $cursor, $str, $bin, $cut)
180
180
$ m = count ($ str ) - 1 ;
181
181
$ i = $ lineCut = 0 ;
182
182
183
+ if ($ this ->flags & self ::DUMP_STRING_LENGTH ) {
184
+ $ this ->line .= '( ' .$ attr ['length ' ].') ' ;
185
+ }
183
186
if ($ bin ) {
184
187
$ this ->line .= 'b ' ;
185
188
}
@@ -249,7 +252,7 @@ public function enterHash(Cursor $cursor, $type, $class, $hasChild)
249
252
} elseif (Cursor::HASH_RESOURCE === $ type ) {
250
253
$ prefix = $ this ->style ('note ' , $ class .' resource ' ).($ hasChild ? ' { ' : ' ' );
251
254
} else {
252
- $ prefix = $ class ? $ this ->style ('note ' , 'array: ' .$ class ).' [ ' : '[ ' ;
255
+ $ prefix = $ class && !( $ this -> flags & self :: DUMP_LIGHT_ARRAY ) ? $ this ->style ('note ' , 'array: ' .$ class ).' [ ' : '[ ' ;
253
256
}
254
257
255
258
if ($ cursor ->softRefCount || 0 < $ cursor ->softRefHandle ) {
@@ -314,6 +317,9 @@ protected function dumpKey(Cursor $cursor)
314
317
switch ($ cursor ->hashType ) {
315
318
default :
316
319
case Cursor::HASH_INDEXED :
320
+ if ($ this ->flags & self ::DUMP_LIGHT_ARRAY ) {
321
+ break ;
322
+ }
317
323
$ style = 'index ' ;
318
324
case Cursor::HASH_ASSOC :
319
325
if (is_int ($ key )) {
0 commit comments