CNAB400Conv6Processor::createDetail()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Umbrella\Ya\RetornoBoleto\Cnab\Cnab400\Convenio\Processor;
4
5
use Umbrella\Ya\RetornoBoleto\Cnab\Cnab400\Convenio\DetailConvenio;
6
use Umbrella\Ya\RetornoBoleto\Cnab\Cnab400\Convenio\HeaderConvenio;
7
8
/**
9
 * Classe para leitura de arquivos de retorno de cobranças no padrão CNAB400/CBR643 com convênio de 7 posições.<br/>
10
 * Layout Padrão CNAB/Febraban 400 posições<br/>.
11
 * Baseado na documentação para "Layout de Arquivo Retorno para convênios na faixa numérica entre 1.000.000 a 9.999.999
12
 * (Convênios de 7 posições). Versão Set/09" do Banco do Brasil (arquivo Doc8826BR643Pos6.pdf),
13
 * disponível em http://www.bb.com.br/docs/pub/emp/empl/dwn/Doc8826BR643Pos6.pdf
14
 * @author Ítalo Lelis de Vietro <[email protected]>
15
 */
16
class CNAB400Conv6Processor extends AbstractCNAB400Processor
17
{
18
    /**
19
     * @property int DETALHE Define o valor que identifica uma coluna do tipo DETALHE 
20
     */
21
    const DETALHE = 1;
22
23
    public function createHeader()
24
    {
25
        return new HeaderConvenio();
26
    }
27
28
    public function createDetail()
29
    {
30
        return new DetailConvenio();
31
    }
32
33
    /**
34
     * Processa a linha header do arquivo
35
     * @param string $linha Linha do header de arquivo processado
36
     * @return string Retorna um vetor contendo os dados dos campos do header do arquivo. 
37
     */
38
    protected function processarHeaderArquivo($linha)
39
    {
40
        $header = parent::processarHeaderArquivo($linha);
41
        $header->setConvenio($linha->substr(41, 6)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
42
            ->setSequencialRet($linha->substr(101, 7)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
43
            ->addComplemento($linha->substr(108, 287)->trim());
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
44
45
        return $header;
46
    }
47
48
    /**
49
     * Processa uma linha detalhe do arquivo.
50
     * @param string $linha Linha detalhe do arquivo processado
51
     * @return string Retorna um vetor contendo os dados dos campos da linha detalhe. 
52
     */
53
    protected function processarDetalhe($linha)
54
    {
55
        $detail = parent::processarDetalhe($linha);
56
        $detail
57
            ->setConvenio($linha->substr(32, 6)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
58
            ->setControle($linha->substr(38, 25)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
59
            ->setNossoNumero($linha->substr(63, 11)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
60
            ->setDvNossoNumero($linha->substr(74, 1)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
61
            ->setTipoCobranca($linha->substr(75, 1)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
62
            ->setTipoCobrancaCmd72($linha->substr(76, 1)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
63
            ->setDiasCalculo($linha->substr(77, 4)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
64
            ->setNatureza($linha->substr(81, 2)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
65
            ->addUsoBanco($linha->substr(83, 3)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
66
            ->setVariacaoCarteira($linha->substr(86, 3)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
67
            ->setContaCaucao($linha->substr(89, 1)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
68
            ->addUsoBanco($linha->substr(90, 5)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
69
            ->addUsoBanco($linha->substr(95, 1)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
70
            ->setConfirmacao($linha->substr(127, 20)->trim())
0 ignored issues
show
Bug introduced by
The method substr cannot be called on $linha (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
71
        ;
72
        return $detail;
73
    }
74
}
75