Passed
Push — master ( bbf304...9b7dcb )
by Antônio
01:39
created

Instancia::getListaEntidade()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 2
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace OBRSDK\HttpClient\Nucleo;
10
11
/**
12
 * Description of Instancia
13
 *
14
 * @author Antonio
15
 */
16
abstract class Instancia {
17
18
    private $instancia;
19
20
    /**
21
     *
22
     * @var \OBRSDK\HttpClient\Nucleo\ApiCliente
23
     */
24
    protected $apiCliente;
25
26
    public function __construct(\OBRSDK\ObjetoBoletosRegistrados $instancia) {
27
        $this->instancia = $instancia;
28
        $this->apiCliente = new ApiCliente($instancia);
29
    }
30
31
    /**
32
     * 
33
     * @return \OBRSDK\ObjetoBoletosRegistrados
34
     */
35
    public function getInstancia() {
36
        return $this->instancia;
37
    }
38
39
    /**
40
     * 
41
     * @param string $index
42
     * @param \OBRSDK\Entidades\Abstratos\AEntidadePropriedades $entidade
43
     * @return array
44
     */
45
    protected function getListaEntidade($index, \OBRSDK\Entidades\Abstratos\AEntidadePropriedades $entidade) {
46
        $resposta = $this->apiCliente
47
                ->getRespostaArray();
48
49
        $lista = [];
50
        foreach ($resposta[$index] as $resultado) {
51
            $entidade->setAtributos($resultado);
52
            $lista[] = $entidade;
53
        }
54
55
        return $lista;
56
    }
57
58
}
59