Completed
Push — master ( e40ab2...2d4eb1 )
by Roberto
05:08 queued 12s
created

Danfce::creditsIntegratorFooter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace NFePHP\DA\NFe;
4
5
/**
6
 * Classe para a impressão em PDF do Documento Auxiliar de NFe Consumidor
7
 * NOTA: Esta classe não é a indicada para quem faz uso de impressoras térmicas ESCPOS
8
 *
9
 * @category  Library
10
 * @package   nfephp-org/sped-da
11
 * @copyright 2009-2019 NFePHP
12
 * @license   http://www.gnu.org/licenses/lesser.html LGPL v3
13
 * @link      http://github.com/nfephp-org/sped-da for the canonical source repository
14
 * @author    Roberto Spadim <roberto at spadim dot com dot br>
15
 */
16
use Exception;
17
use InvalidArgumentException;
18
use NFePHP\DA\Legacy\Dom;
19
use NFePHP\DA\Legacy\Pdf;
20
use NFePHP\DA\Common\DaCommon;
21
use Com\Tecnick\Barcode\Barcode;
22
use DateTime;
23
24
class Danfce extends DaCommon
25
{
26
    protected $papel;
27
    protected $paperwidth = 80;
28
    protected $xml; // string XML NFe
29
    protected $logomarca=''; // path para logomarca em jpg
30
    protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####";
31
    protected $nfeProc;
32
    protected $nfe;
33
    protected $infNFe;
34
    protected $ide;
35
    protected $enderDest;
36
    protected $ICMSTot;
37
    protected $imposto;
38
    protected $emit;
39
    protected $enderEmit;
40
    protected $qrCode;
41
    protected $urlChave;
42
    protected $det;
43
    protected $infAdic;
44
    protected $textoAdic;
45
    protected $tpEmis;
46
    protected $pag;
47
    protected $vTroco;
48
    protected $dest;
49
    protected $imgQRCode;
50
    protected $urlQR = '';
51
    protected $pdf;
52
    protected $margemInterna = 2;
53
    protected $hMaxLinha = 9;
54
    protected $hBoxLinha = 6;
55
    protected $hLinha = 3;
56
  
57
    /**
58
     * __contruct
59
     *
60
     * @param string $docXML
61
     */
62
    public function __construct(
63
        $docXML
64
    ) {
65
        
66
        $this->xml = $docXML;
67
      
68
        if (!empty($this->xml)) {
69
            $this->dom = new Dom();
0 ignored issues
show
Bug introduced by
The property dom does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
70
            $this->dom->loadXML($this->xml);
71
            $this->ide = $this->dom->getElementsByTagName("ide")->item(0);
72
            if ($this->getTagValue($this->ide, "mod") != '65') {
73
                throw new InvalidArgumentException("O xml do DANFE deve ser uma NFC-e modelo 65");
74
            }
75
            $this->nfeProc = $this->dom->getElementsByTagName("nfeProc")->item(0);
76
            $this->nfe = $this->dom->getElementsByTagName("NFe")->item(0);
77
            $this->infNFe = $this->dom->getElementsByTagName("infNFe")->item(0);
78
            $this->emit = $this->dom->getElementsByTagName("emit")->item(0);
79
            $this->enderEmit = $this->dom->getElementsByTagName("enderEmit")->item(0);
80
            $this->det = $this->dom->getElementsByTagName("det");
81
            $this->dest = $this->dom->getElementsByTagName("dest")->item(0);
82
            $this->imposto = $this->dom->getElementsByTagName("imposto")->item(0);
83
            $this->ICMSTot = $this->dom->getElementsByTagName("ICMSTot")->item(0);
84
            $this->tpImp = $this->ide->getElementsByTagName("tpImp")->item(0)->nodeValue;
0 ignored issues
show
Bug introduced by
The property tpImp does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
85
            $this->infAdic = $this->dom->getElementsByTagName("infAdic")->item(0);
86
            $this->tpEmis = $this->dom->getValue($this->ide, "tpEmis");
0 ignored issues
show
Documentation introduced by
$this->ide is of type object<DOMNode>, but the function expects a object<NFePHP\DA\Legacy\DOMElement>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
87
                
88
            //se for o layout 4.0 busca pelas tags de detalhe do pagamento
89
            //senao, busca pelas tags de pagamento principal
90
            if ($this->infNFe->getAttribute("versao") == "4.00") {
91
                $this->pag = $this->dom->getElementsByTagName("detPag");
92
                
93
                $tagPag = $this->dom->getElementsByTagName("pag")->item(0);
94
                $this->vTroco = $this->getTagValue($tagPag, "vTroco");
95
            } else {
96
                $this->pag = $this->dom->getElementsByTagName("pag");
97
            }
98
        }
99
        $this->qrCode = !empty($this->dom->getElementsByTagName('qrCode')->item(0)->nodeValue)
100
            ? $this->dom->getElementsByTagName('qrCode')->item(0)->nodeValue : null;
101
        $this->urlChave = !empty($this->dom->getElementsByTagName('urlChave')->item(0)->nodeValue)
102
            ? $this->dom->getElementsByTagName('urlChave')->item(0)->nodeValue : null;
103
    }
104
    
105
    /**
106
     * Dados brutos do PDF
107
     * @return string
108
     */
109
    public function render(
110
        $logo = ''
111
    ) {
112
        if (empty($this->pdf)) {
113
            $this->monta($logo);
114
        }
115
        return $this->pdf->getPdf();
116
    }
117
    
118
    /**
119
     * Seta a largura do papel de impressão
120
     * @param int $width
121
     */
122
    public function setPaperWidth($width = 80)
123
    {
124
        $this->paperwidth = $width;
125
    }
126
    
127
    /**
128
     * Parametros de impressão
129
     * @param string $orientacao
130
     * @param string $papel
131
     * @param int $margSup
132
     * @param int $margEsq
133
     */
134
    public function printParameters($orientacao = '', $papel = 'A4', $margSup = 2, $margEsq = 2)
135
    {
136
        //do nothing
137
    }
138
    
139
    /**
140
     *
141
     * @param string $logo
142
     */
143
    protected function monta(
144
        $logo = ''
145
    ) {
146
        
147
        $this->aFontTit = array('font' => $this->fontePadrao, 'size' => 9, 'style' => 'B');
0 ignored issues
show
Bug introduced by
The property aFontTit does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
148
        $this->aFontTex = array('font' => $this->fontePadrao, 'size' => 8, 'style' => '');
0 ignored issues
show
Bug introduced by
The property aFontTex does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
149
        if (!empty($logo)) {
150
            $this->logomarca = $this->adjustImage($logo, true);
151
        }
152
        $qtdItens = $this->det->length;
153
        $qtdPgto = $this->pag->length;
154
        $hMaxLinha = $this->hMaxLinha;
155
        $hBoxLinha = $this->hBoxLinha;
0 ignored issues
show
Unused Code introduced by
$hBoxLinha is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
156
        $hLinha = $this->hLinha;
157
        $tamPapelVert = 160 + 16 + 12 + (($qtdItens - 1) * $hMaxLinha) + ($qtdPgto * $hLinha);
158
        // verifica se existe informações adicionais
159
        $this->textoAdic = '';
160
        if (isset($this->infAdic)) {
161
            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ?
162
            'Inf. Contribuinte: '.
163
            trim($this->anfaveaDANFE($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : '';
164
        }
165
        if (!empty($this->textoAdic)) {
166
            $this->textoAdic = str_replace([';', '|'], "\n", $this->textoAdic);
167
            $alinhas = explode("\n", $this->textoAdic);
168
            $numlinhasdados = 0;
169
            $tempPDF = new Pdf(); // cria uma instancia temporaria da class pdf
170
            $tempPDF->setFont('times', '', '8'); // seta a font do PDF
171
            foreach ($alinhas as $linha) {
172
                $linha = trim($linha);
173
                $numlinhasdados += $tempPDF->wordWrap($linha, 76 - 0.2);
0 ignored issues
show
Documentation introduced by
$linha is of type string, but the function expects a object<NFePHP\DA\Legacy\type>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
76 - 0.2 is of type double, but the function expects a object<NFePHP\DA\Legacy\type>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
174
            }
175
            $hdadosadic = round(($numlinhasdados + 1) * $tempPDF->fontSize, 0);
176
            if ($hdadosadic < 5) {
177
                $hdadosadic = 5;
178
            }
179
            // seta o tamanho do papel
180
            $tamPapelVert += $hdadosadic;
181
        }
182
        
183
        $this->orientacao = 'P';
184
        $this->papel = [$this->paperwidth, $tamPapelVert];
185
        $this->logoAlign = 'L';
186
        $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel);
0 ignored issues
show
Documentation introduced by
$this->papel is of type array<integer,integer|do...,"1":"double|integer"}>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
187
        
188
        //margens do PDF, em milímetros. Obs.: a margem direita é sempre igual à
189
        //margem esquerda. A margem inferior *não* existe na FPDF, é definida aqui
190
        //apenas para controle se necessário ser maior do que a margem superior
191
        $margSup = 2;
192
        $margEsq = 2;
193
        $margInf = 2;
194
        // posição inicial do conteúdo, a partir do canto superior esquerdo da página
195
        $xInic = $margEsq;
196
        $yInic = $margSup;
197
        $maxW = 80;
198
        $maxH = $tamPapelVert;
199
        //total inicial de paginas
200
        $totPag = 1;
0 ignored issues
show
Unused Code introduced by
$totPag is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
201
        //largura imprimivel em mm: largura da folha menos as margens esq/direita
202
        $this->wPrint = $maxW-($margEsq*2);
0 ignored issues
show
Documentation Bug introduced by
The property $wPrint was declared of type double, but $maxW - $margEsq * 2 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
203
        //comprimento (altura) imprimivel em mm: altura da folha menos as margens
204
        //superior e inferior
205
        $this->hPrint = $maxH-$margSup-$margInf;
0 ignored issues
show
Documentation Bug introduced by
It seems like $maxH - $margSup - $margInf can also be of type integer. However, the property $hPrint is declared as type double. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
206
        // estabelece contagem de paginas
207
        $this->pdf->aliasNbPages();
208
        $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
209
        $this->pdf->setDrawColor(0, 0, 0);
210
        $this->pdf->setFillColor(255, 255, 255);
211
        $this->pdf->open(); // inicia o documento
212
        $this->pdf->addPage($this->orientacao, $this->papel); // adiciona a primeira página
0 ignored issues
show
Documentation introduced by
$this->papel is of type array<integer,integer|do...,"1":"double|integer"}>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
213
        $this->pdf->setLineWidth(0.1); // define a largura da linha
214
        $this->pdf->setTextColor(0, 0, 0);
215
        $this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
216
        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
217
        $hcabecalhoSecundario = 10 + 3;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
218
        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha) ;//box poduto
219
        $hTotal = 12; //box total (FIXO)
220
        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3;//para pagamentos
221
        if (!empty($this->vTroco)) {
222
            $hpagamentos += $hLinha;
223
        }
224
                
225
        $hmsgfiscal = 21 + 2; // para imposto (FIXO)
226
        $hcliente = !isset($this->dest) ? 6 : 12; // para cliente (FIXO)
227
        $hcontingencia = $this->tpEmis == 9 ? 6 : 0; // para contingência (FIXO)
0 ignored issues
show
Unused Code introduced by
$hcontingencia is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
228
        $hQRCode = 50; // para qrcode (FIXO)
229
        $hCabecItens = 4; //cabeçalho dos itens
230
        
231
        $hUsado = $hCabecItens;
0 ignored issues
show
Unused Code introduced by
$hUsado is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
232
        $w2 = round($this->wPrint * 0.31, 0);
0 ignored issues
show
Unused Code introduced by
$w2 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
233
        $totPag = 1;
234
        $pag = 1;
235
        $x = $xInic;
236
        //COLOCA CABEÇALHO
237
        $y = $yInic;
238
        $y = $this->cabecalhoDANFE($x, $y, $hcabecalho, $pag, $totPag);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $y is correct as $this->cabecalhoDANFE($x...becalho, $pag, $totPag) (which targets NFePHP\DA\NFe\Danfce::cabecalhoDANFE()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
$y is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
239
        //COLOCA CABEÇALHO SECUNDÁRIO
240
        $y = $hcabecalho;
241
        $y = $this->cabecalhoSecundarioDANFE($x, $y, $hcabecalhoSecundario);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $y is correct as $this->cabecalhoSecundar... $hcabecalhoSecundario) (which targets NFePHP\DA\NFe\Danfce::cabecalhoSecundarioDANFE()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
$y is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
242
        $jj = $hcabecalho + $hcabecalhoSecundario;
0 ignored issues
show
Unused Code introduced by
$jj is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
243
        //COLOCA PRODUTOS
244
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario;
245
        $y = $this->produtosDANFE($x, $y, $hprodutos);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $y is correct as $this->produtosDANFE($x, $y, $hprodutos) (which targets NFePHP\DA\NFe\Danfce::produtosDANFE()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
$y is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
246
        //COLOCA TOTAL
247
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos;
248
        $y = $this->totalDANFE($x, $y, $hTotal);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $y is correct as $this->totalDANFE($x, $y, $hTotal) (which targets NFePHP\DA\NFe\Danfce::totalDANFE()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
$y is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
249
        //COLOCA PAGAMENTOS
250
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
251
        $y = $this->pagamentosDANFE($x, $y, $hpagamentos);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $y is correct as $this->pagamentosDANFE($x, $y, $hpagamentos) (which targets NFePHP\DA\NFe\Danfce::pagamentosDANFE()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
$y is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
252
        //COLOCA MENSAGEM FISCAL
253
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
254
        $y = $this->fiscalDANFE($x, $y, $hmsgfiscal);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $y is correct as $this->fiscalDANFE($x, $y, $hmsgfiscal) (which targets NFePHP\DA\NFe\Danfce::fiscalDANFE()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
$y is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
255
        //COLOCA CONSUMIDOR
256
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
257
        $y = $this->consumidorDANFE($x, $y, $hcliente);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $y is correct as $this->consumidorDANFE($x, $y, $hcliente) (which targets NFePHP\DA\NFe\Danfce::consumidorDANFE()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
$y is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
258
        //COLOCA QRCODE
259
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos
260
            + $hTotal + $hpagamentos + $hmsgfiscal + $hcliente;
261
        $y = $this->qrCodeDANFE($x, $y, $hQRCode);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $y is correct as $this->qrCodeDANFE($x, $y, $hQRCode) (which targets NFePHP\DA\NFe\Danfce::qrCodeDANFE()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
$y is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
262
        
263
        //adiciona as informações opcionais
264
        if (!empty($this->textoAdic)) {
265
            $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos
266
            + $hTotal + $hpagamentos + $hmsgfiscal + $hcliente + $hQRCode;
267
            $hInfAdic = 0;
268
            $y = $this->blocoInfAdic($x, $y, $hInfAdic);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $y is correct as $this->blocoInfAdic($x, $y, $hInfAdic) (which targets NFePHP\DA\NFe\Danfce::blocoInfAdic()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
$y is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
269
        }
270
    }
271
    
272
    protected function cabecalhoDANFE($x = 0, $y = 0, $h = 0, $pag = '1', $totPag = '1')
0 ignored issues
show
Unused Code introduced by
The parameter $x is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $pag is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $totPag is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
273
    {
274
        $emitRazao  = $this->getTagValue($this->emit, "xNome");
275
        $emitCnpj   = $this->getTagValue($this->emit, "CNPJ");
276
        $emitCnpj   = $this->formatField($emitCnpj, "##.###.###/####-##");
277
        $emitIE     = $this->getTagValue($this->emit, "IE");
278
        $emitIM     = $this->getTagValue($this->emit, "IM");
279
        $emitFone = $this->getTagValue($this->enderEmit, "fone");
280
        $foneLen = strlen($emitFone);
281
        if ($foneLen>0) {
282
            $ddd = substr($emitFone, 0, 2);
283
            $fone1 = substr($emitFone, -8);
284
            $digito9 = ' ';
285
            if ($foneLen == 11) {
286
                $digito9 = substr($emitFone, 2, 1);
287
            }
288
            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
289
        } else {
290
            $emitFone = '';
291
        }
292
        $emitLgr = $this->getTagValue($this->enderEmit, "xLgr");
293
        $emitNro = $this->getTagValue($this->enderEmit, "nro");
294
        $emitCpl = $this->getTagValue($this->enderEmit, "xCpl", "");
295
        $emitBairro = $this->getTagValue($this->enderEmit, "xBairro");
296
        $emitCEP = $this->formatField($this->getTagValue($this->enderEmit, "CEP"), "#####-###");
297
        $emitMun = $this->getTagValue($this->enderEmit, "xMun");
298
        $emitUF = $this->getTagValue($this->enderEmit, "UF");
299
        // CONFIGURAÇÃO DE POSIÇÃO
300
        $margemInterna = $this->margemInterna;
301
        $maxW = $this->wPrint;
302
        $h = $h-($margemInterna);
303
        //COLOCA LOGOMARCA
304
        if (!empty($this->logomarca)) {
305
            $xImg = $margemInterna;
306
            $yImg = $margemInterna + 1;
307
            $logoInfo = getimagesize($this->logomarca);
308
            $logoWmm = ($logoInfo[0]/72)*25.4;
309
            $logoHmm = ($logoInfo[1]/72)*25.4;
310
            $nImgW = 30;
311
            $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
312
            $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
313
            $xRs = ($maxW*0.4) + $margemInterna;
314
            $wRs = ($maxW*0.6);
315
            $alignEmit = 'L';
316
        } else {
317
            $xRs = $margemInterna;
318
            $wRs = ($maxW*1);
319
            $alignEmit = 'L';
320
        }
321
        //COLOCA RAZÃO SOCIAL
322
        $texto = $emitRazao;
323
        $texto = $texto . "\nCNPJ:" . $emitCnpj;
324
        $texto = $texto . "\nIE:" . $emitIE;
325
        if (!empty($emitIM)) {
326
            $texto = $texto . " - IM:" . $emitIM;
327
        }
328
        $texto = $texto . "\n" . $emitLgr . "," . $emitNro . " " . $emitCpl . "," . $emitBairro
329
                . ". CEP:" . $emitCEP . ". " . $emitMun . "-" . $emitUF . $emitFone;
330
        $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
331
        $this->pdf->textBox($xRs, $y, $wRs, $h, $texto, $aFont, 'C', $alignEmit, 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
332
    }
333
    
334
    protected function cabecalhoSecundarioDANFE($x = 0, $y = 0, $h = 0)
0 ignored issues
show
Unused Code introduced by
The parameter $h is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
335
    {
336
        $margemInterna = $this->margemInterna;
0 ignored issues
show
Unused Code introduced by
$margemInterna is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
337
        $maxW = $this->wPrint;
338
        $w = ($maxW*1);
339
        $hBox1 = 7;
340
        $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
341
        $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
342
        $this->pdf->textBox($x, $y, $w, $hBox1, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
343
        $hBox2 = 4;
344
        $yBox2 = $y + $hBox1;
345
        $texto = "\nNFC-e não permite aproveitamento de crédito de ICMS";
346
        $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
347
        $this->pdf->textBox($x, $yBox2, $w, $hBox2, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
348
    }
349
    
350
    protected function produtosDANFE($x = 0, $y = 0, $h = 0)
0 ignored issues
show
Unused Code introduced by
The parameter $h is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
351
    {
352
        $margemInterna = $this->margemInterna;
0 ignored issues
show
Unused Code introduced by
$margemInterna is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
353
        $maxW = $this->wPrint;
354
        $qtdItens = $this->det->length;
355
        $w = ($maxW*1);
356
        $hLinha = $this->hLinha;
357
        $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
358
        $wBoxCod = $w*0.17;
359
        $texto = "CÓDIGO";
360
        $this->pdf->textBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
361
        $wBoxDescricao = $w*0.43;
362
        $xBoxDescricao = $wBoxCod + $x;
363
        $texto = "DESCRICÃO";
364
        $this->pdf->textBox(
365
            $xBoxDescricao,
366
            $y,
367
            $wBoxDescricao,
368
            $hLinha,
369
            $texto,
370
            $aFontCabProdutos,
371
            'T',
372
            'L',
373
            0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
374
            '',
375
            false
376
        );
377
        $wBoxQt = $w*0.08;
378
        $xBoxQt = $wBoxDescricao + $xBoxDescricao;
379
        $texto = "QT";
380
        $this->pdf->textBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
381
        $wBoxUn = $w*0.06;
382
        $xBoxUn = $wBoxQt + $xBoxQt;
383
        $texto = "UN";
384
        $this->pdf->textBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
385
        $wBoxVl = $w*0.13;
386
        $xBoxVl = $wBoxUn + $xBoxUn;
387
        $texto = "VALOR";
388
        $this->pdf->textBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
389
        $wBoxTotal = $w*0.13;
390
        $xBoxTotal = $wBoxVl + $xBoxVl;
391
        $texto = "TOTAL";
392
        $this->pdf->textBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
393
        $hBoxLinha = $this->hBoxLinha;
0 ignored issues
show
Unused Code introduced by
$hBoxLinha is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
394
        $hMaxLinha = $this->hMaxLinha;
395
        $cont = 0;
396
        $aFontProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
397
        if ($qtdItens > 0) {
398
            foreach ($this->det as $detI) {
399
                $thisItem   = $detI;
400
                $prod       = $thisItem->getElementsByTagName("prod")->item(0);
401
                $nitem      = $thisItem->getAttribute("nItem");
0 ignored issues
show
Unused Code introduced by
$nitem is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
402
                $cProd      = $this->getTagValue($prod, "cProd");
403
                $xProd      = $this->getTagValue($prod, "xProd");
404
                $qCom       = number_format($this->getTagValue($prod, "qCom"), 2, ",", ".");
405
                $uCom       = $this->getTagValue($prod, "uCom");
406
                $vUnCom     = number_format($this->getTagValue($prod, "vUnCom"), 2, ",", ".");
407
                $vProd      = number_format($this->getTagValue($prod, "vProd"), 2, ",", ".");
408
                //COLOCA PRODUTO
409
                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
410
                //COLOCA PRODUTO CÓDIGO
411
                $wBoxCod = $w*0.17;
412
                $texto = $cProd;
413
                $this->pdf->textBox(
414
                    $x,
415
                    $yBoxProd,
416
                    $wBoxCod,
417
                    $hMaxLinha,
418
                    $texto,
419
                    $aFontProdutos,
420
                    'C',
421
                    'C',
422
                    0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
423
                    '',
424
                    false
425
                );
426
                //COLOCA PRODUTO DESCRIÇÃO
427
                $wBoxDescricao = $w*0.43;
428
                $xBoxDescricao = $wBoxCod + $x;
429
                $texto = $xProd;
430
                $this->pdf->textBox(
431
                    $xBoxDescricao,
432
                    $yBoxProd,
433
                    $wBoxDescricao,
434
                    $hMaxLinha,
435
                    $texto,
436
                    $aFontProdutos,
437
                    'C',
438
                    'L',
439
                    0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
440
                    '',
441
                    false
442
                );
443
                //COLOCA PRODUTO QUANTIDADE
444
                $wBoxQt = $w*0.08;
445
                $xBoxQt = $wBoxDescricao + $xBoxDescricao;
446
                $texto = $qCom;
447
                $this->pdf->textBox(
448
                    $xBoxQt,
449
                    $yBoxProd,
450
                    $wBoxQt,
451
                    $hMaxLinha,
452
                    $texto,
453
                    $aFontProdutos,
454
                    'C',
455
                    'C',
456
                    0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
457
                    '',
458
                    false
459
                );
460
                //COLOCA PRODUTO UNIDADE
461
                $wBoxUn = $w*0.06;
462
                $xBoxUn = $wBoxQt + $xBoxQt;
463
                $texto = $uCom;
464
                $this->pdf->textBox(
465
                    $xBoxUn,
466
                    $yBoxProd,
467
                    $wBoxUn,
468
                    $hMaxLinha,
469
                    $texto,
470
                    $aFontProdutos,
471
                    'C',
472
                    'C',
473
                    0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
474
                    '',
475
                    false
476
                );
477
                //COLOCA PRODUTO VL UNITÁRIO
478
                $wBoxVl = $w*0.13;
479
                $xBoxVl = $wBoxUn + $xBoxUn;
480
                $texto = $vUnCom;
481
                $this->pdf->textBox(
482
                    $xBoxVl,
483
                    $yBoxProd,
484
                    $wBoxVl,
485
                    $hMaxLinha,
486
                    $texto,
487
                    $aFontProdutos,
488
                    'C',
489
                    'R',
490
                    0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
491
                    '',
492
                    false
493
                );
494
                //COLOCA PRODUTO VL TOTAL
495
                $wBoxTotal = $w*0.13;
496
                $xBoxTotal = $wBoxVl + $xBoxVl;
497
                $texto = $vProd;
498
                $this->pdf->textBox(
499
                    $xBoxTotal,
500
                    $yBoxProd,
501
                    $wBoxTotal,
502
                    $hMaxLinha,
503
                    $texto,
504
                    $aFontProdutos,
505
                    'C',
506
                    'R',
507
                    0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
508
                    '',
509
                    false
510
                );
511
                
512
                $cont++;
513
            }
514
        }
515
    }
516
    
517
    protected function totalDANFE($x = 0, $y = 0, $h = 0)
0 ignored issues
show
Unused Code introduced by
The parameter $h is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
518
    {
519
        $margemInterna = $this->margemInterna;
0 ignored issues
show
Unused Code introduced by
$margemInterna is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
520
        $maxW = $this->wPrint;
521
        $hLinha = 3;
522
        $wColEsq = ($maxW*0.7);
523
        $wColDir = ($maxW*0.3);
524
        $xValor = $x + $wColEsq;
525
        $qtdItens = $this->det->length;
526
        $vProd = $this->getTagValue($this->ICMSTot, "vProd");
527
        $vNF = $this->getTagValue($this->ICMSTot, "vNF");
528
        $vDesc  = $this->getTagValue($this->ICMSTot, "vDesc");
529
        $vFrete = $this->getTagValue($this->ICMSTot, "vFrete");
530
        $vTotTrib = $this->getTagValue($this->ICMSTot, "vTotTrib");
531
        $texto = "Qtd. Total de Itens";
532
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
533
        $this->pdf->textBox($x, $y, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
534
        $texto = $qtdItens;
535
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
536
        $this->pdf->textBox($xValor, $y, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
537
        $yTotal = $y + ($hLinha);
538
        $texto = "Total de Produtos";
539
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
540
        $this->pdf->textBox($x, $yTotal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
541
        $texto = "R$ " . number_format($vProd, 2, ",", ".");
542
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
543
        $this->pdf->textBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
544
        $yDesconto = $y + ($hLinha*2);
545
        $texto = "Descontos";
546
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
547
        $this->pdf->textBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
548
        $texto = "R$ " . $vDesc;
549
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
550
        $this->pdf->textBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
551
        $yFrete= $y + ($hLinha*3);
552
        $texto = "Frete";
553
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
554
        $this->pdf->textBox($x, $yFrete, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
555
        $texto = "R$ " . $vFrete;
556
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
557
        $this->pdf->textBox($xValor, $yFrete, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
558
        $yTotalFinal = $y + ($hLinha*4);
559
        $texto = "Total";
560
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
561
        $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
562
        $texto = "R$ " . $vNF;
563
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
564
        $this->pdf->textBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
565
        $yTotalFinal = $y + ($hLinha*5);
566
        $texto = "Informação dos Tributos Totais Incidentes";
567
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
568
        $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
569
        $texto = "R$ " . $vTotTrib;
570
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
571
        $this->pdf->textBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
572
    }
573
    
574
    protected function pagamentosDANFE($x = 0, $y = 0, $h = 0)
0 ignored issues
show
Unused Code introduced by
The parameter $h is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
575
    {
576
        $y += 6;
577
        $margemInterna = $this->margemInterna;
0 ignored issues
show
Unused Code introduced by
$margemInterna is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
578
        $maxW = $this->wPrint;
579
        $qtdPgto = $this->pag->length;
580
        $w = ($maxW*1);
581
        $hLinha = $this->hLinha;
582
        $wColEsq = ($maxW*0.7);
583
        $wColDir = ($maxW*0.3);
0 ignored issues
show
Unused Code introduced by
$wColDir is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
584
        $xValor = $x + $wColEsq;
0 ignored issues
show
Unused Code introduced by
$xValor is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
585
        $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
586
        $wBoxEsq = $w*0.7;
587
        $texto = "FORMA DE PAGAMENTO";
588
        $this->pdf->textBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
589
        $wBoxDir = $w*0.3;
590
        $xBoxDescricao = $x + $wBoxEsq;
591
        $texto = "VALOR PAGO";
592
        $this->pdf->textBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
593
        $cont = 0;
594
        if ($qtdPgto > 0) {
595
            foreach ($this->pag as $pagI) {
596
                $tPag = $this->getTagValue($pagI, "tPag");
597
                $tPagNome = $this->tipoPag($tPag);
598
                $tPnome = $tPagNome;
0 ignored issues
show
Unused Code introduced by
$tPnome is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
599
                $vPag = number_format($this->getTagValue($pagI, "vPag"), 2, ",", ".");
600
                $card = $pagI->getElementsByTagName("card")->item(0);
601
                $cardCNPJ = '';
0 ignored issues
show
Unused Code introduced by
$cardCNPJ is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
602
                $tBand = '';
0 ignored issues
show
Unused Code introduced by
$tBand is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
603
                $tBandNome = '';
0 ignored issues
show
Unused Code introduced by
$tBandNome is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
604
                if (isset($card)) {
605
                    $cardCNPJ = $this->getTagValue($card, "CNPJ");
0 ignored issues
show
Unused Code introduced by
$cardCNPJ is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
606
                    $tBand    = $this->getTagValue($card, "tBand");
607
                    $cAut = $this->getTagValue($card, "cAut");
0 ignored issues
show
Unused Code introduced by
$cAut is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
608
                    $tBandNome = self::getCardName($tBand);
0 ignored issues
show
Unused Code introduced by
$tBandNome is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
609
                }
610
                //COLOCA PRODUTO
611
                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
612
                //COLOCA PRODUTO CÓDIGO
613
                $texto = $tPagNome;
614
                $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
615
                //COLOCA PRODUTO DESCRIÇÃO
616
                $xBoxDescricao = $wBoxEsq + $x;
617
                $texto = "R$ " . $vPag;
618
                $this->pdf->textBox(
619
                    $xBoxDescricao,
620
                    $yBoxProd,
621
                    $wBoxDir,
622
                    $hLinha,
623
                    $texto,
624
                    $aFontPgto,
625
                    'C',
626
                    'R',
627
                    0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
628
                    '',
629
                    false
630
                );
631
                $cont++;
632
            }
633
            
634
            if (!empty($this->vTroco)) {
635
                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
636
                //COLOCA PRODUTO CÓDIGO
637
                $texto = 'Troco';
638
                $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
639
                //COLOCA PRODUTO DESCRIÇÃO
640
                $xBoxDescricao = $wBoxEsq + $x;
641
                $texto = "R$ " . number_format($this->vTroco, 2, ",", ".");
642
                $this->pdf->textBox(
643
                    $xBoxDescricao,
644
                    $yBoxProd,
645
                    $wBoxDir,
646
                    $hLinha,
647
                    $texto,
648
                    $aFontPgto,
649
                    'C',
650
                    'R',
651
                    0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
652
                    '',
653
                    false
654
                );
655
            }
656
        }
657
    }
658
    
659
    protected function fiscalDANFE($x = 0, $y = 0, $h = 0)
660
    {
661
        $y += 6;
662
        $margemInterna = $this->margemInterna;
0 ignored issues
show
Unused Code introduced by
$margemInterna is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
663
        $maxW = $this->wPrint;
664
        $w = ($maxW*1);
665
        $hLinha = $this->hLinha;
666
        $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
667
        $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
668
        $digVal = $this->getTagValue($this->nfe, "DigestValue");
0 ignored issues
show
Unused Code introduced by
$digVal is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
669
        $chNFe = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
670
        $tpAmb = $this->getTagValue($this->ide, 'tpAmb');
0 ignored issues
show
Unused Code introduced by
$tpAmb is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
671
        
672
        if ($this->checkCancelada()) {
673
            //101 Cancelamento
674
            $this->pdf->setTextColor(255, 0, 0);
675
            $texto = "NFCe CANCELADA";
676
            $this->pdf->textBox($x, $y - 25, $w, $h, $texto, $aFontTit, 'C', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
677
            $this->pdf->setTextColor(0, 0, 0);
678
        }
679
        
680
        if ($this->checkDenegada()) {
681
            //uso denegado
682
            $this->pdf->setTextColor(255, 0, 0);
683
            $texto = "NFCe CANCELADA";
684
            $this->pdf->textBox($x, $y - 25, $w, $h, $texto, $aFontTit, 'C', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
685
            $this->pdf->SetTextColor(0, 0, 0);
686
        }
687
        
688
        $cUF = $this->getTagValue($this->ide, 'cUF');
0 ignored issues
show
Unused Code introduced by
$cUF is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
689
        $nNF = $this->getTagValue($this->ide, 'nNF');
690
        $serieNF = str_pad($this->getTagValue($this->ide, "serie"), 3, "0", STR_PAD_LEFT);
691
        $dhEmi = $this->getTagValue($this->ide, "dhEmi");
692
        $dhEmilocal = new \DateTime($dhEmi);
693
        $dhEmiLocalFormat = $dhEmilocal->format('d/m/Y H:i:s');
694
        $texto = "ÁREA DE MENSAGEM FISCAL";
695
        $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
696
        $yTex1 = $y + ($hLinha*1);
697
        $hTex1 = $hLinha*2;
698
        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmiLocalFormat . " - Via Consumidor";
699
        $this->pdf->textBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
700
        $yTex2 = $y + ($hLinha*3);
701
        $hTex2 = $hLinha*2;
702
        
703
        $texto = !empty($this->urlChave) ? "Consulte pela Chave de Acesso em " . $this->urlChave : '';
704
        $this->pdf->textBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
705
        $texto = "CHAVE DE ACESSO";
706
        $yTit2 = $y + ($hLinha*5);
707
        $this->pdf->textBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
708
        $yTex3 = $y + ($hLinha*6);
709
        $texto = $chNFe;
710
        $this->pdf->textBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
711
    }
712
    
713
    protected function consumidorDANFE($x = 0, $y = 0, $h = 0)
0 ignored issues
show
Unused Code introduced by
The parameter $h is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
714
    {
715
        $y += 6;
716
        $margemInterna = $this->margemInterna;
0 ignored issues
show
Unused Code introduced by
$margemInterna is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
717
        $maxW = $this->wPrint;
718
        $w = ($maxW*1);
719
        $hLinha = $this->hLinha;
720
        $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
721
        $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
722
        $texto = "CONSUMIDOR";
723
        $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
724
        if (isset($this->dest)) {
725
            $considEstrangeiro = !empty($this->dest->getElementsByTagName("idEstrangeiro")->item(0)->nodeValue)
726
                    ? $this->dest->getElementsByTagName("idEstrangeiro")->item(0)->nodeValue
727
                    : '';
728
            $consCPF = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
729
                    ? $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue
730
                    : '';
731
            $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
732
                    ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
733
                    : '';
734
            $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor
0 ignored issues
show
Unused Code introduced by
$cDest is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
735
            $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
736
            $consNome = $this->getTagValue($this->dest, "xNome");
737
            $consLgr = $this->getTagValue($enderDest, "xLgr");
738
            $consNro = $this->getTagValue($enderDest, "nro");
739
            $consCpl = $this->getTagValue($enderDest, "xCpl", " - ");
740
            $consBairro = $this->getTagValue($enderDest, "xBairro");
741
            $consCEP = $this->formatField($this->getTagValue($enderDest, "CEP"));
742
            $consMun = $this->getTagValue($enderDest, "xMun");
743
            $consUF = $this->getTagValue($enderDest, "UF");
744
            $considEstrangeiro = $this->getTagValue($this->dest, "idEstrangeiro");
745
            $consCPF = $this->getTagValue($this->dest, "CPF");
746
            $consCNPJ = $this->getTagValue($this->dest, "CNPJ");
747
            $consDoc = "";
748
            if (!empty($consCNPJ)) {
749
                $consDoc = "CNPJ: $consCNPJ";
750
            } elseif (!empty($consCPF)) {
751
                $consDoc = "CPF: $consCPF";
752
            } elseif (!empty($considEstrangeiro)) {
753
                $consDoc = "id: $considEstrangeiro";
754
            }
755
            $consEnd = "";
756
            if (!empty($consLgr)) {
757
                $consEnd = $consLgr
758
                    . ","
759
                    . $consNro
760
                    . " "
761
                    . $consCpl
762
                    . ","
763
                    . $consBairro
764
                    . ". CEP:"
765
                    . $consCEP
766
                    . ". "
767
                    . $consMun
768
                    . "-"
769
                    . $consUF;
770
            }
771
            $yTex1 = $y + $hLinha;
772
            $texto = $consNome;
773
            if (!empty($consDoc)) {
774
                $texto .= " - ". $consDoc . "\n" . $consEnd;
775
                $this->pdf->textBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
776
            }
777
        } else {
778
            $yTex1 = $y + $hLinha;
779
            $texto = "Consumidor não identificado";
780
            $this->pdf->textBox($x, $yTex1, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
781
        }
782
    }
783
    
784
    protected function qrCodeDANFE($x = 0, $y = 0, $h = 0)
0 ignored issues
show
Unused Code introduced by
The parameter $h is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
785
    {
786
        $y += 6;
787
        $margemInterna = $this->margemInterna;
788
        $maxW = $this->wPrint;
789
        $w = ($maxW*1)+4;
790
        $hLinha = $this->hLinha;
0 ignored issues
show
Unused Code introduced by
$hLinha is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
791
        $hBoxLinha = $this->hBoxLinha;
792
        $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
0 ignored issues
show
Unused Code introduced by
$aFontTit is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
793
        $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
794
        $dhRecbto = '';
795
        $nProt = '';
796
        if (isset($this->nfeProc)) {
797
            $nProt = $this->getTagValue($this->nfeProc, "nProt");
798
            $dhRecbto  = $this->getTagValue($this->nfeProc, "dhRecbto");
799
        }
800
        $barcode = new Barcode();
801
        $bobj = $barcode->getBarcodeObj(
802
            'QRCODE,M',
803
            $this->qrCode,
804
            -4,
805
            -4,
806
            'black',
807
            array(-2, -2, -2, -2)
808
        )->setBackgroundColor('white');
809
        $qrcode = $bobj->getPngData();
810
        $wQr = 50;
811
        $hQr = 50;
812
        $yQr = ($y+$margemInterna);
813
        $xQr = ($w/2) - ($wQr/2);
814
        // prepare a base64 encoded "data url"
815
        $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
816
        $info = getimagesize($pic);
0 ignored issues
show
Unused Code introduced by
$info is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
817
        $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
818
        $dt = new DateTime($dhRecbto);
819
        $yQr = ($yQr+$hQr+$margemInterna);
820
        $this->pdf->textBox($x, $yQr, $w-4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
821
            . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
822
    }
823
   
824
    protected function blocoInfAdic($x = 0, $y = 0, $h = 0)
0 ignored issues
show
Unused Code introduced by
The parameter $h is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
825
    {
826
        $y += 17;
827
        $margemInterna = $this->margemInterna;
0 ignored issues
show
Unused Code introduced by
$margemInterna is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
828
        $maxW = $this->wPrint;
829
        $w = ($maxW * 1);
830
        $hLinha = $this->hLinha;
831
        $aFontTit = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
832
        $aFontTex = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
833
        // seta o textbox do titulo
834
        $texto = "INFORMAÇÃO ADICIONAL";
835
        if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")->length) {
836
            $y += 3;
837
            $msg = $this->nfeProc->getElementsByTagName("xMsg")->item(0)->nodeValue;
838
            $msg = str_replace('|', "\n", $msg);
839
            $texto .= " {$msg}";
840
            $heigthText = $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
0 ignored issues
show
Unused Code introduced by
$heigthText is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
841
            $y += 4;
842
        } else {
843
            $heigthText = $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
0 ignored issues
show
Unused Code introduced by
$heigthText is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
844
        }
845
        // seta o textbox do texto adicional
846
        $this->pdf->textBox($x, $y+3, $w-2, $hLinha-3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
847
    }
848
    
849
    /**
850
     * anfavea
851
     * Função para transformar o campo cdata do padrão ANFAVEA para
852
     * texto imprimível
853
     *
854
     * @param  string $cdata campo CDATA
855
     * @return string conteúdo do campo CDATA como string
856
     */
857
    protected function anfaveaDANFE($cdata = '')
858
    {
859
        if ($cdata == '') {
860
            return '';
861
        }
862
        //remove qualquer texto antes ou depois da tag CDATA
863
        $cdata = str_replace('<![CDATA[', '<CDATA>', $cdata);
864
        $cdata = str_replace(']]>', '</CDATA>', $cdata);
865
        $cdata = preg_replace('/\s\s+/', ' ', $cdata);
866
        $cdata = str_replace("> <", "><", $cdata);
867
        $len = strlen($cdata);
868
        $startPos = strpos($cdata, '<');
869
        if ($startPos === false) {
870
            return $cdata;
871
        }
872
        for ($x=$len; $x>0; $x--) {
873
            if (substr($cdata, $x, 1) == '>') {
874
                $endPos = $x;
875
                break;
876
            }
877
        }
878
        if ($startPos > 0) {
879
            $parte1 = substr($cdata, 0, $startPos);
880
        } else {
881
            $parte1 = '';
882
        }
883
        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
0 ignored issues
show
Bug introduced by
The variable $endPos does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
884
        if ($endPos < $len) {
885
            $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
886
        } else {
887
            $parte3 = '';
888
        }
889
        $texto = trim($parte1).' '.trim($parte3);
890
        if (strpos($parte2, '<CDATA>') === false) {
891
            $cdata = '<CDATA>'.$parte2.'</CDATA>';
892
        } else {
893
            $cdata = $parte2;
894
        }
895
        //carrega o xml CDATA em um objeto DOM
896
        $dom = new Dom();
897
        $dom->loadXML($cdata, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG);
898
        //$xml = $dom->saveXML();
899
        //grupo CDATA infADprod
900
        $id = $dom->getElementsByTagName('id')->item(0);
901
        $div = $dom->getElementsByTagName('div')->item(0);
902
        $entg = $dom->getElementsByTagName('entg')->item(0);
903
        $dest = $dom->getElementsByTagName('dest')->item(0);
904
        $ctl = $dom->getElementsByTagName('ctl')->item(0);
905
        $ref = $dom->getElementsByTagName('ref')->item(0);
906
        if (isset($id)) {
907
            if ($id->hasAttributes()) {
908
                foreach ($id->attributes as $attr) {
909
                    $name = $attr->nodeName;
910
                    $value = $attr->nodeValue;
911
                    $texto .= " $name : $value";
912
                }
913
            }
914
        }
915
        if (isset($div)) {
916
            if ($div->hasAttributes()) {
917
                foreach ($div->attributes as $attr) {
918
                    $name = $attr->nodeName;
919
                    $value = $attr->nodeValue;
920
                    $texto .= " $name : $value";
921
                }
922
            }
923
        }
924
        if (isset($entg)) {
925
            if ($entg->hasAttributes()) {
926
                foreach ($entg->attributes as $attr) {
927
                    $name = $attr->nodeName;
928
                    $value = $attr->nodeValue;
929
                    $texto .= " $name : $value";
930
                }
931
            }
932
        }
933
        if (isset($dest)) {
934
            if ($dest->hasAttributes()) {
935
                foreach ($dest->attributes as $attr) {
936
                    $name = $attr->nodeName;
937
                    $value = $attr->nodeValue;
938
                    $texto .= " $name : $value";
939
                }
940
            }
941
        }
942
        if (isset($ctl)) {
943
            if ($ctl->hasAttributes()) {
944
                foreach ($ctl->attributes as $attr) {
945
                    $name = $attr->nodeName;
946
                    $value = $attr->nodeValue;
947
                    $texto .= " $name : $value";
948
                }
949
            }
950
        }
951
        if (isset($ref)) {
952
            if ($ref->hasAttributes()) {
953
                foreach ($ref->attributes as $attr) {
954
                    $name = $attr->nodeName;
955
                    $value = $attr->nodeValue;
956
                    $texto .= " $name : $value";
957
                }
958
            }
959
        }
960
        //grupo CADATA infCpl
961
        $t = $dom->getElementsByTagName('transmissor')->item(0);
962
        $r = $dom->getElementsByTagName('receptor')->item(0);
963
        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
964
        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
965
        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
966
        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
967
        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
968
        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
969
        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
970
        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
971
        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
972
        if (isset($t)) {
973
            if ($t->hasAttributes()) {
974
                $texto .= " Transmissor ";
975
                foreach ($t->attributes as $attr) {
976
                    $name = $attr->nodeName;
977
                    $value = $attr->nodeValue;
978
                    $texto .= " $name : $value";
979
                }
980
            }
981
        }
982
        if (isset($r)) {
983
            if ($r->hasAttributes()) {
984
                $texto .= " Receptor ";
985
                foreach ($r->attributes as $attr) {
986
                    $name = $attr->nodeName;
987
                    $value = $attr->nodeValue;
988
                    $texto .= " $name : $value";
989
                }
990
            }
991
        }
992
        return $texto;
993
    }
994
    
995
    protected static function getCardName($tBand)
996
    {
997
        switch ($tBand) {
998
            case '01':
999
                $tBandNome = 'VISA';
1000
                break;
1001
            case '02':
1002
                $tBandNome = 'MASTERCARD';
1003
                break;
1004
            case '03':
1005
                $tBandNome = 'AMERICAM EXPRESS';
1006
                break;
1007
            case '04':
1008
                $tBandNome = 'SOROCRED';
1009
                break;
1010
            case '99':
1011
                $tBandNome = 'OUTROS';
1012
                break;
1013
            default:
1014
                $tBandNome = '';
1015
        }
1016
        return $tBandNome;
1017
    }
1018
      
1019
    protected function checkCancelada()
1020
    {
1021
        if (!isset($this->nfeProc)) {
1022
            return false;
1023
        }
1024
        $cStat = $this->getTagValue($this->nfeProc, "cStat");
1025
        return $cStat == '101' ||
1026
                $cStat == '151' ||
1027
                $cStat == '135' ||
1028
                $cStat == '155';
1029
    }
1030
1031
    protected function checkDenegada()
1032
    {
1033
        if (!isset($this->nfeProc)) {
1034
            return false;
1035
        }
1036
        //NÃO ERA NECESSÁRIO ESSA FUNÇÃO POIS SÓ SE USA
1037
        //1 VEZ NO ARQUIVO INTEIRO
1038
        $cStat = $this->getTagValue($this->nfeProc, "cStat");
1039
        return $cStat == '110' ||
1040
               $cStat == '301' ||
1041
               $cStat == '302';
1042
    }
1043
}
1044