public function processar()
{
if (method_exists($this, 'init')) {
$this->init();
}
foreach ($this->file as $linha) {
$recordType = $this->rem(8, 8, $linha);
if ($recordType == '0') {
$this->processarHeader($linha);
} elseif ($recordType == '1') {
$this->processarHeaderLote($linha);
} elseif ($recordType == '3') {
if ($this->getSegmentType($linha) == 'T') {
$this->incrementDetalhe();
}
if ($this->processarDetalhe($linha) === false) {
unset($this->detalhe[$this->increment]);
$this->increment--;
}
} else {
if ($recordType == '5') {
$this->processarTrailerLote($linha);
} else {
if ($recordType == '9') {
$this->processarTrailerArquivo($linha);
}
}
}
}
if (method_exists($this, 'finalize')) {
$this->finalize();
}
return $this;
}