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

src/Factory/CadPatrocinado.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 do Patrocinado
7
 *
8
 * @category  NFePHP
9
 * @package   NFePHP\eFinanc\Factory\CadPatrocinado
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 CadPatrocinado 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 = 'evtCadPatrocinado';
35
   
36
    /**
37
     * Faz a premontagem se necessário
38
     *
39
     * @return
40
     */
41 3
    protected function premonta()
42
    {
43 3
        return;
44
    }
45
    
46
    /**
47
     * Cria a tag Info
48
     *
49
     * @param  string $giin
50
     * @param  string $nome
51
     * @param  string $endereco
52
     * @param  string $municipio
53
     * @param  string $uf
54
     * @param  string $pais
55
     * @param  string $paisResidencia
56
     * @return Dom
57
     */
58 3
    public function tagInfo($giin, $cnpj, $nome, $endereco, $municipio, $pais, $paisResidencia)
59
    {
60 3
        $identificador = 'tag infoPatrocinado ';
61 3
        $info = $this->dom->createElement("infoPatrocinado");
62 3
        $this->dom->addChild(
63 2
            $info,
64 3
            "GIIN",
65 2
            $giin,
66 3
            true,
67 1
            $identificador . ""
68 2
        );
69 3
        $this->dom->addChild(
70 2
            $info,
71 3
            "CNPJ",
72 2
            $cnpj,
73 3
            true,
74 1
            $identificador . ""
75 2
        );
76 3
        $this->dom->addChild(
77 2
            $info,
78 3
            "nomePatrocinado",
79 2
            $nome,
80 3
            true,
81 1
            $identificador . "Nome do patrocinado"
82 2
        );
83
        
84 3
        $infoadress = $this->dom->createElement("endereco");
85 3
        $this->dom->addChild(
86 2
            $infoadress,
87 3
            "enderecoLivre",
88 2
            $endereco,
89 3
            true,
90 1
            $identificador . "Endereco do patrocinado"
91 2
        );
92 3
        $this->dom->addChild(
93 2
            $infoadress,
94 3
            "municipio",
95 2
            $municipio,
96 3
            true,
97 1
            $identificador . "Municipio do patrocinado"
98 2
        );
99 3
        $this->dom->addChild(
100 2
            $infoadress,
101 3
            "pais",
102 2
            $pais,
103 3
            true,
104 1
            $identificador . "Sigla do pais do Patrocinado"
105 2
        );
106 3
        $this->dom->appChild($info, $infoadress);
107
        
108 3
        $this->dom->addChild(
109 2
            $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 3
            "paisResidencia",
111 2
            $paisResidencia,
112 3
            true,
113 1
            $identificador . "Sigla do pais residencia do Patrocinado"
114 2
        );
115 3
        $this->info = $info;
116 3
        return $info;
117
    }
118
}
119