/**
  * @test
  * @dataProvider provideStreamFiles
  *
  * @param $file
  */
 public function readStream($file)
 {
     stream_wrapper_register('xmlseq', 'XMLSequenceStream');
     $path = "xmlseq://" . $file;
     $count = 0;
     $xmlFileContents = array();
     while (XMLSequenceStream::notAtEndOfSequence($path)) {
         $count++;
         $reader = new XMLReader();
         $reader->open($path, 'UTF-8', LIBXML_COMPACT | LIBXML_PARSEHUGE);
         /** @var XMLElementIterator|XMLReaderNode $elements */
         $elements = new XMLElementIterator($reader);
         $xmlFileContents[] = $elements->getSimpleXMLElement();
     }
     XMLSequenceStream::clean();
     stream_wrapper_unregister('xmlseq');
     $this->assertGreaterThanOrEqual(2, $count, 'number of sequences');
 }
    }
    echo "\n";
    isset($index) || ($index = -1);
    isset($path) || ($path = '(parse error)');
    $summary = sprintf("scanning done. scanned %d elements in %d seconds. last element was %s.\n", $index + 1, microtime(true) - $start, $path);
    echo $summary;
    $errors = libxml_get_errors();
    if ($errors) {
        printf("had %d parse error(s):\n", count($errors));
        foreach ($errors as $error) {
            printf("[level: %d; code: %d; line: %d column: %d]\n%s ", $error->level, $error->code, $error->line, $error->column, $error->message);
        }
    }
    libxml_use_internal_errors($saved);
} while (substr($file, 0, 9) === 'xmlseq://' && XMLSequenceStream::notAtEndOfSequence($file));
XMLSequenceStream::clean();
stream_wrapper_unregister('xmlseq');
printf("creating scan summary in %s.\n", $outfile);
class Levels
{
    protected $levels;
    public function __construct(array $levels)
    {
        $this->levels = $levels;
    }
    public function getChildrenOfAtLevel($prefix, $level)
    {
        $children = [];
        if (isset($this->levels[$level])) {
            foreach ($this->levels[$level] as $path => $count) {
                if (substr($path, 0, strlen($prefix) + 1) === "{$prefix}/") {
 public function __construct()
 {
     # fputs(STDOUT, sprintf('<contruct>'));
     self::$readers || (self::$readers = new BufferedFileReaders());
 }