class Dumper extends CliDumper
{
private $formatter;
+ private $forceArrayIndexes;
protected static $onlyControlCharsRx = '/^[\x00-\x1F\x7F]+$/';
- protected static $controlCharsRx = '/([\x00-\x1F\x7F]+)/';
- protected static $controlCharsMap = array(
+ protected static $controlCharsRx = '/([\x00-\x1F\x7F]+)/';
+ protected static $controlCharsMap = array(
"\0" => '\0',
"\t" => '\t',
"\n" => '\n',
"\033" => '\e',
);
- public function __construct(OutputFormatter $formatter)
+ public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false)
{
$this->formatter = $formatter;
+ $this->forceArrayIndexes = $forceArrayIndexes;
parent::__construct();
$this->setColors(false);
}
*/
protected function dumpKey(Cursor $cursor)
{
- if (Cursor::HASH_INDEXED !== $cursor->hashType) {
+ if ($this->forceArrayIndexes || Cursor::HASH_INDEXED !== $cursor->hashType) {
parent::dumpKey($cursor);
}
}