RetornosCliente::getRetornoDados()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
nc 2
nop 2
dl 0
loc 14
rs 9.4285
c 2
b 0
f 0
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
     * Pega todos os arquivos de retornos já enviado para a API
13
     * 
14
     * @return \OBRSDK\Entidades\Retornos[]
15
     */
16
    public function getListaRetornos() {
17
        $this->apiCliente->addAuthorization()
18
                ->get("retornos");
19
20
        return $this->getListaEntidade('retornos', new \OBRSDK\Entidades\Retornos());
21
    }
22
23
    /**
24
     * Se passado o parametro isFile como true, a identificacao deve ser 
25
     * o caminho para o arquivo.
26
     * Se não, deve ser o ID de retorno enviado anteriormente
27
     * 
28
     * @param string $identificacao
29
     * @param bool $isFile
30
     * @return \OBRSDK\Entidades\Retornos
31
     */
32
    public function getRetornoDados($identificacao, $isFile = false) {
33
        $this->apiCliente->addAuthorization();
34
        if ($isFile) {
35
            $this->apiCliente->enviarArquivo('retornos', $identificacao);
36
        } else {
37
            $this->apiCliente->get('retornos/' . $identificacao);
38
        }
39
40
        $resposta = $this->apiCliente->getRespostaArray();
41
42
        $respostaEntidade = new \OBRSDK\Entidades\Retornos();
43
        $respostaEntidade->setAtributos($resposta);
44
45
        return $respostaEntidade;
46
    }
47
48
}
49