Passed
Push — master ( a8bd15...2c03c7 )
by Antônio
02:13
created

RetornosCliente::getRetorno()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 1
dl 8
loc 8
rs 9.4285
1
<?php
2
3
namespace OBRSDK\HttpClient;
4
5
/**
6
 * @author Antonio
7
 * @since 19/10/2017
8
 */
9
class RetornosCliente extends Nucleo\Instancia {
10
11
    /**
12
     * Faz o upload do arquivo de retorno do banco para a API
13
     * 
14
     * @param string $arquivo
15
     * @return \OBRSDK\Entidades\Retornos Lista de boletos e propriedades que 
16
     * foram processados pelo arquivo de retorno
17
     */
18 View Code Duplication
    public function enviarArquivoRetorno($arquivo) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
        $resposta = $this->apiCliente->addAuthorization()
20
                ->enviarArquivo('retornos', $arquivo)
21
                ->getResposta(true);
22
23
        $respostaEntidade = new \OBRSDK\Entidades\Retornos();
24
        $respostaEntidade->setAtributos($resposta);
0 ignored issues
show
Bug introduced by
It seems like $resposta can also be of type object; however, parameter $atributos of OBRSDK\Entidades\Abstrat...himento::setAtributos() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

24
        $respostaEntidade->setAtributos(/** @scrutinizer ignore-type */ $resposta);
Loading history...
25
26
        return $respostaEntidade;
27
    }
28
29
    /**
30
     * Pega dados de retorno enviado anteriormente
31
     * 
32
     * @param string $retornoId
33
     * @return \OBRSDK\Entidades\Retornos
34
     */
35 View Code Duplication
    public function getRetorno($retornoId) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
        $resposta = $this->apiCliente->addAuthorization()
37
                ->get('retornos/' . $retornoId)
38
                ->getResposta(true);
39
40
        $respostaEntidade = new \OBRSDK\Entidades\Retornos();
41
        $respostaEntidade->setAtributos($resposta);
0 ignored issues
show
Bug introduced by
It seems like $resposta can also be of type object; however, parameter $atributos of OBRSDK\Entidades\Abstrat...himento::setAtributos() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

41
        $respostaEntidade->setAtributos(/** @scrutinizer ignore-type */ $resposta);
Loading history...
42
        return $respostaEntidade;
43
    }
44
45
}
46