protected function calculaTotalLotes() { $this->totalLotes = 1; $layout = $this->layout->getLayout(); $linhaTrailerArquivoStr = $this->linhas[count($this->linhas) - 1]; $linha = new Linha($linhaTrailerArquivoStr, $this->layout, 'retorno'); if (strtoupper($layout) === strtoupper('cnab240')) { // conforme cnab240 febraban $definicao = array('pos' => array(18, 23), 'picture' => '9(6)'); $this->totalLotes = (int) $linha->obterValorCampo($definicao); } elseif (strtoupper($layout) === strtoupper('cnab400')) { $this->totalLotes = 1; // cnab400 apenas 1 lote } return $this->totalLotes; }