Completed
Push — master ( 9654f6...5e67fa )
by Roberto
14:40
created

src/Factory/CadIntermediario.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace NFePHP\eFinanc\Factory;
4
5
/**
6
 * Classe construtora do evento de Cadastro dos Intermediarios
7
 *
8
 * @category  NFePHP
9
 * @package   NFePHP\eFinanc\Factory\CadIntermediario
10
 * @copyright Copyright (c) 2016
11
 * @license   http://www.gnu.org/licenses/lesser.html LGPL v3
12
 * @author    Roberto L. Machado <linux.rlm at gmail dot com>
13
 * @link      http://github.com/nfephp-org/sped-efinanceira for the canonical source repository
14
 */
15
16
use NFePHP\eFinanc\Factory\Factory;
17
18 View Code Duplication
class CadIntermediario extends Factory
19
{
20
21
    /**
22
     * Objeto Dom::class Tag infoCadastro
23
     *
24
     * @var Dom
25
     */
26
    protected $info;
27
    
28
    
29
    /**
30
     * estabelece qual a tag será assinada
31
     *
32
     * @var string
33
     */
34
    protected $signTag = 'evtCadIntermediario';
35
   
36
    /**
37
     * Faz a premontagem se necessário
38
     *
39
     * @return
40
     */
41
    protected function premonta()
42
    {
43
        return;
44
    }
45
    
46
    /**
47
     * Cria a tag Info
48
     *
49
     * @param  string $giin
50
     * @param  string $tpNI
51
     * @param  string $nIIntermediario
52
     * @param  string $nome
53
     * @param  string $endereco
54
     * @param  string $pais
55
     * @param  string $paisResidencia
56
     * @return Dom
57
     */
58
    public function tagInfo($giin, $tpNI, $nIIntermediario, $nome, $endereco, $pais, $paisResidencia)
59
    {
60
        $identificador = 'tag infoIntermediario ';
61
        $info = $this->dom->createElement("infoIntermediario");
62
        $this->dom->addChild(
63
            $info,
64
            "GIIN",
65
            $giin,
66
            true,
67
            $identificador . "Informar GIIN (Global Intermediary Identification Number)"
68
        );
69
        $this->dom->addChild(
70
            $info,
71
            "tpNI",
72
            $tpNI,
73
            true,
74
            $identificador . "Tipo de NI do intermediário"
75
        );
76
        $this->dom->addChild(
77
            $info,
78
            "NIIntermediario",
79
            $nIIntermediario,
80
            true,
81
            $identificador . "Número de identificação do Intermediário"
82
        );
83
        $this->dom->addChild(
84
            $info,
85
            "nomeIntermediario",
86
            $nome,
87
            true,
88
            $identificador . "Informar a razão social do Intermediário"
89
        );
90
        
91
        $infoadress = $this->dom->createElement("endereco");
92
        $this->dom->addChild(
93
            $infoadress,
94
            "enderecoLivre",
95
            $endereco,
96
            true,
97
            $identificador . "Endereço do Intermediário"
98
        );
99
        $this->dom->addChild(
100
            $infoadress,
101
            "pais",
102
            $pais,
103
            true,
104
            $identificador . "Sigla do pais"
105
        );
106
        $this->dom->appChild($info, $infoadress);
107
        
108
        $this->dom->addChild(
109
            $info,
0 ignored issues
show
$info of type object<DOMNode> is not a sub-type of object<DOMElement>. It seems like you assume a child class of the class DOMNode to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
110
            "paisResidencia",
111
            $paisResidencia,
112
            true,
113
            $identificador . "Sigla do pais residencia"
114
        );
115
        $this->info = $info;
116
        return $info;
117
    }
118
}
119