Skip to content

Commit

Permalink
Ajustando leitor de arquivos CNAB 240
Browse files Browse the repository at this point in the history
  • Loading branch information
fhferreira committed Dec 2, 2016
1 parent 35fdfe3 commit b7c5d41
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Retorno/CNAB240/Arquivo.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function parseFileToArray()
$lines = [];
while (!feof($file)) {
$line = fgets($file);
$line = trim($line);

$line = ltrim($line);
$line = str_replace("\r\n","", $line);
if ($line) {
$lines[] = $line;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Retorno/CNAB240/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace Sicoob\Retorno\CNAB240;

class Header
class Header extends LineAbstract
{

/*
01.0 001 003 003 - Num Controle¹ Banco Código do Sicoob na Compensação: "756"
02.0 004 007 004 - Num Lote Lote de Serviço: "0000"
Expand Down
2 changes: 1 addition & 1 deletion src/Retorno/CNAB240/HeaderLote.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Sicoob\Retorno\CNAB240;

class HeaderLote
class HeaderLote extends LineAbstract
{
/*
01.1 001 003 003 - Num Controle Banco Código do Banco na Compensação: "756"
Expand Down
2 changes: 1 addition & 1 deletion src/Retorno/CNAB240/Trailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Sicoob\Retorno\CNAB240;

class Trailer
class Trailer extends LineAbstract
{
/*
01.9 001 003 003 - Num Controle Banco Código do Banco na Compensação: "756"
Expand Down
2 changes: 1 addition & 1 deletion src/Retorno/CNAB240/TrailerLote.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Sicoob\Retorno\CNAB240;

class TrailerLote
class TrailerLote extends LineAbstract
{
/*
01.5 001 003 003 - Num Controle Banco Código do Banco na Compensação: "756"
Expand Down
5 changes: 5 additions & 0 deletions tests/Retorno/CNAB240/ArquivoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public function testFileExists()
$this->filename = $this->path . '/../../fixtures/2016-11-08.ret';
$this->object->fill($this->filename);
$this->assertFileExists($this->object->filename);
var_dump($this->object->header->line);
$this->assertEquals(240, strlen($this->object->header->line));
$this->assertEquals(240, strlen($this->object->headerLote->line));
$this->assertEquals(240, strlen($this->object->trailerLote->line));
$this->assertEquals(240, strlen($this->object->trailer->line));
}

public function testParse()
Expand Down

0 comments on commit b7c5d41

Please sign in to comment.