Changing the look of the tree of RecursiveTreeIterator

Code
<?php

$tree 
= [
    
'level1' => [
        
'val1',
        
'val2',
        
'val3',
        
'level2' => [
            
'val4',
            
'val5',
        ],
    ],
];

$iterator = new RecursiveTreeIterator(
    new 
RecursiveArrayIterator($tree)
);

$iterator->setPrefixPart(RecursiveTreeIterator::PREFIX_LEFT' ');
$iterator->setPrefixPart(RecursiveTreeIterator::PREFIX_MID_HAS_NEXT'');
$iterator->setPrefixPart(RecursiveTreeIterator::PREFIX_MID_LAST'|');
$iterator->setPrefixPart(RecursiveTreeIterator::PREFIX_END_HAS_NEXT'-');
$iterator->setPrefixPart(RecursiveTreeIterator::PREFIX_END_LAST'\\');
$iterator->setPrefixPart(RecursiveTreeIterator::PREFIX_RIGHT' ');

echo 
'<pre>';
foreach (
$iterator as $val) {
    echo 
$val PHP_EOL;
}
echo 
'</pre>';
Result
 \ Array
 |- val1
 |- val2
 |- val3
 |\ Array
 ||- val4
 ||\ val5
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6