SegmentoJ::buildDetail()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 39
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 39
rs 8.8571
cc 1
eloc 31
nc 1
nop 1
1
<?php
2
3
namespace Umbrella\Ya\RetornoBoleto\Cnab\Cnab240\Segmento;
4
5
use Stringy\Stringy;
6
use Umbrella\Ya\RetornoBoleto\Cnab\Cnab240\Detail;
7
use Umbrella\Ya\RetornoBoleto\Model\Banco;
8
use Umbrella\Ya\RetornoBoleto\Model\Cedente;
9
10
class SegmentoJ extends AbstractSegmento
11
{
12
13
    public function buildDetail(Stringy $linha)
14
    {
15
        $detail = new Detail();
16
        $cedente = new Cedente();
17
        $banco = new Banco();
18
19
        $banco->setCod($linha->substr(1, 3));
20
21
        $detail
0 ignored issues
show
Bug introduced by
The method setDesconto() does not seem to exist on object<Umbrella\Ya\Retor...to\Cnab\Cnab240\Detail>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
22
            ->setLote($linha->substr(4, 4))
23
            ->setRegistro($linha->substr(8, 1))
24
            ->setNumRegistroLote($linha->substr(9, 5))
25
            ->setSegmento($linha->substr(14, 1))
26
            ->setTipoMovimento($linha->substr(15, 1))
27
            ->setCodMovimento($linha->substr(16, 2))
28
            ->setCodBarras($linha->substr(18, 44))
29
            ->setDataVencimento($this->createDate($linha->substr(92, 8)))
30
            ->setValorTitulo($this->convertToFloat($linha->substr(100, 15)))
31
            ->setDesconto($this->convertToFloat($linha->substr(115, 15)))
32
            ->setAcrescimos($this->convertToFloat($linha->substr(130, 15)))
33
            ->setDataPagamento($this->createDate($linha->substr(145, 8)))
34
            ->setValorPagamento($this->convertToFloat($linha->substr(153, 15)))
35
            ->setQuantidadeMoeda($this->convertToFloat($linha->substr(168, 15), 5))
36
            ->setReferenciaSacado($linha->substr(183, 20))
37
            ->setNossoNumero($linha->substr(203, 20))
38
            ->setCodMoeda($linha->substr(223, 2))
39
            ->addCnab($linha->substr(225, 6))
40
            ->addOcorrencia($linha->substr(231, 10));
41
42
43
        $cedente
44
            ->setNome($linha->substr(62, 30))
45
            ->setBanco($banco);
46
47
        $detail
48
            ->setCedente($cedente);
49
50
        return $detail;
51
    }
52
}
53