public function next()
{
$this->valid = false;
$style = null;
$type = null;
$columnIndex = null;
$rowBuilder = null;
$currentKey = 0;
while ($this->xml->read()) {
if (\XMLReader::ELEMENT === $this->xml->nodeType) {
switch ($this->xml->name) {
case 'row':
$currentKey = (int) $this->xml->getAttribute('r');
$rowBuilder = $this->rowBuilderFactory->create();
break;
case 'c':
$columnIndex = $this->columnIndexTransformer->transform($this->xml->getAttribute('r'));
$style = $this->getValue($this->xml->getAttribute('s'));
$type = $this->getValue($this->xml->getAttribute('t'));
break;
case 'v':
$rowBuilder->addValue($columnIndex, $this->valueTransformer->transform($this->xml->readString(), $type, $style));
break;
}
} elseif (\XMLReader::END_ELEMENT === $this->xml->nodeType) {
switch ($this->xml->name) {
case 'row':
$currentValue = $rowBuilder->getData();
if (count($currentValue)) {
$this->currentKey = $currentKey;
$this->currentValue = $currentValue;
$this->valid = true;
return;
}
break;
case 'sheetData':
break 2;
}
}
}
}