Passed
Push — master ( cb9572...9fae0b )
by Roberto
03:05 queued 10s
created

Danfce::blocoInfAdic()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
nc 2
nop 3
dl 0
loc 24
ccs 0
cts 22
cp 0
crap 12
rs 9.536
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
     * Add the credits to the integrator in the footer message
107
     * @param string $message
108
     */
109
    public function creditsIntegratorFooter($message = '')
110
    {
111
        $this->creditos = trim($message);
112
    }
113
    
114
    /**
115
     * Dados brutos do PDF
116
     * @return string
117
     */
118
    public function render(
119
        $logo = ''
120
    ) {
121
        if (empty($this->pdf)) {
122
            $this->monta($logo);
123
        }
124
        return $this->pdf->getPdf();
125
    }
126
    
127
    /**
128
     * Seta a largura do papel de impressão
129
     * @param int $width
130
     */
131
    public function setPaperWidth($width = 80)
132
    {
133
        $this->paperwidth = $width;
134
    }
135
    
136
    /**
137
     * Parametros de impressão
138
     * @param string $orientacao
139
     * @param string $papel
140
     * @param int $margSup
141
     * @param int $margEsq
142
     */
143
    public function printParameters($orientacao = '', $papel = 'A4', $margSup = 2, $margEsq = 2)
144
    {
145
        //do nothing
146
    }
147
    
148
    /**
149
     *
150
     * @param string $logo
151
     */
152
    protected function monta(
153
        $logo = ''
154
    ) {
155
        
156
        $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...
157
        $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...
158
        if (!empty($logo)) {
159
            $this->logomarca = $this->adjustImage($logo, true);
160
        }
161
        $qtdItens = $this->det->length;
162
        $qtdPgto = $this->pag->length;
163
        $hMaxLinha = $this->hMaxLinha;
164
        $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...
165
        $hLinha = $this->hLinha;
166
        $tamPapelVert = 160 + 16 + 12 + (($qtdItens - 1) * $hMaxLinha) + ($qtdPgto * $hLinha);
167
        // verifica se existe informações adicionais
168
        $this->textoAdic = '';
169
        if (isset($this->infAdic)) {
170
            //$this->textoAdic .= !empty($this->textoAdic) ? "\n" : '';
171
            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ?
172
            'Inf. Contribuinte: '.
173
            trim($this->anfaveaDANFE($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : '';
174
        }
175
        if (!empty($this->textoAdic)) {
176
            $this->textoAdic = str_replace([';', '|'], "\n", $this->textoAdic);
177
            $alinhas = explode("\n", $this->textoAdic);
178
            $numlinhasdados = 0;
179
            $tempPDF = new Pdf(); // cria uma instancia temporaria da class pdf
180
            $tempPDF->setFont('times', '', '8'); // seta a font do PDF
181
            foreach ($alinhas as $linha) {
182
                $linha = trim($linha);
183
                $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...
184
            }
185
            $hdadosadic = round(($numlinhasdados + 1) * $tempPDF->fontSize, 0);
186
            if ($hdadosadic < 5) {
187
                $hdadosadic = 5;
188
            }
189
            // seta o tamanho do papel
190
            $tamPapelVert += $hdadosadic;
191
        }
192
        
193
        $this->orientacao = 'P';
194
        $this->papel = [$this->paperwidth, $tamPapelVert];
195
        $this->logoAlign = 'L';
196
        $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...
197
        
198
        //margens do PDF, em milímetros. Obs.: a margem direita é sempre igual à
199
        //margem esquerda. A margem inferior *não* existe na FPDF, é definida aqui
200
        //apenas para controle se necessário ser maior do que a margem superior
201
        $margSup = 2;
202
        $margEsq = 2;
203
        $margInf = 2;
204
        // posição inicial do conteúdo, a partir do canto superior esquerdo da página
205
        $xInic = $margEsq;
206
        $yInic = $margSup;
207
        $maxW = 80;
208
        $maxH = $tamPapelVert;
209
        //total inicial de paginas
210
        $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...
211
        //largura imprimivel em mm: largura da folha menos as margens esq/direita
212
        $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...
213
        //comprimento (altura) imprimivel em mm: altura da folha menos as margens
214
        //superior e inferior
215
        $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...
216
        // estabelece contagem de paginas
217
        $this->pdf->aliasNbPages();
218
        $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
219
        $this->pdf->setDrawColor(0, 0, 0);
220
        $this->pdf->setFillColor(255, 255, 255);
221
        $this->pdf->open(); // inicia o documento
222
        $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...
223
        $this->pdf->setLineWidth(0.1); // define a largura da linha
224
        $this->pdf->setTextColor(0, 0, 0);
225
        $this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
226
        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
227
        $hcabecalhoSecundario = 10 + 3;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
228
        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha) ;//box poduto
229
        $hTotal = 12; //box total (FIXO)
230
        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3;//para pagamentos
231
        if (!empty($this->vTroco)) {
232
            $hpagamentos += $hLinha;
233
        }
234
                
235
        $hmsgfiscal = 21 + 2; // para imposto (FIXO)
236
        $hcliente = !isset($this->dest) ? 6 : 12; // para cliente (FIXO)
237
        $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...
238
        $hQRCode = 50; // para qrcode (FIXO)
239
        $hCabecItens = 4; //cabeçalho dos itens
240
        
241
        $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...
242
        $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...
243
        $totPag = 1;
244
        $pag = 1;
245
        $x = $xInic;
246
        //COLOCA CABEÇALHO
247
        $y = $yInic;
248
        $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...
249
        //COLOCA CABEÇALHO SECUNDÁRIO
250
        $y = $hcabecalho;
251
        $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...
252
        $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...
253
        //COLOCA PRODUTOS
254
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario;
255
        $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...
256
        //COLOCA TOTAL
257
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos;
258
        $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...
259
        //COLOCA PAGAMENTOS
260
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
261
        $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...
262
        //COLOCA MENSAGEM FISCAL
263
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
264
        $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...
265
        //COLOCA CONSUMIDOR
266
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
267
        $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...
268
        //COLOCA QRCODE
269
        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos
270
            + $hTotal + $hpagamentos + $hmsgfiscal + $hcliente;
271
        $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...
272
        
273
        //adiciona as informações opcionais
274
        if (!empty($this->textoAdic)) {
275
            $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos
276
            + $hTotal + $hpagamentos + $hmsgfiscal + $hcliente + $hQRCode;
277
            $hInfAdic = 0;
278
            $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...
279
        }
280
    }
281
    
282
    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...
283
    {
284
        $emitRazao  = $this->getTagValue($this->emit, "xNome");
285
        $emitCnpj   = $this->getTagValue($this->emit, "CNPJ");
286
        $emitCnpj   = $this->formatField($emitCnpj, "##.###.###/####-##");
287
        $emitIE     = $this->getTagValue($this->emit, "IE");
288
        $emitIM     = $this->getTagValue($this->emit, "IM");
289
        $emitFone = $this->getTagValue($this->enderEmit, "fone");
290
        $foneLen = strlen($emitFone);
291
        if ($foneLen>0) {
292
            $ddd = substr($emitFone, 0, 2);
293
            $fone1 = substr($emitFone, -8);
294
            $digito9 = ' ';
295
            if ($foneLen == 11) {
296
                $digito9 = substr($emitFone, 2, 1);
297
            }
298
            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
299
        } else {
300
            $emitFone = '';
301
        }
302
        $emitLgr = $this->getTagValue($this->enderEmit, "xLgr");
303
        $emitNro = $this->getTagValue($this->enderEmit, "nro");
304
        $emitCpl = $this->getTagValue($this->enderEmit, "xCpl", "");
305
        $emitBairro = $this->getTagValue($this->enderEmit, "xBairro");
306
        $emitCEP = $this->formatField($this->getTagValue($this->enderEmit, "CEP"), "#####-###");
307
        $emitMun = $this->getTagValue($this->enderEmit, "xMun");
308
        $emitUF = $this->getTagValue($this->enderEmit, "UF");
309
        // CONFIGURAÇÃO DE POSIÇÃO
310
        $margemInterna = $this->margemInterna;
311
        $maxW = $this->wPrint;
312
        $h = $h-($margemInterna);
313
        //COLOCA LOGOMARCA
314
        if (!empty($this->logomarca)) {
315
            $xImg = $margemInterna;
316
            $yImg = $margemInterna + 1;
0 ignored issues
show
Unused Code introduced by
$yImg 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...
317
            $logoInfo = getimagesize($this->logomarca);
318
            $logoWmm = ($logoInfo[0]/72)*25.4;
319
            $logoHmm = ($logoInfo[1]/72)*25.4;
320
            $nImgW = 30;
321
            $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
322
            $yImg = $margemInterna + $nImgH/2;
323
            $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
324
            $xRs = ($maxW*0.4) + $margemInterna;
325
            $wRs = ($maxW*0.6);
326
            $alignEmit = 'L';
327
        } else {
328
            $xRs = $margemInterna;
329
            $wRs = ($maxW*1);
330
            $alignEmit = 'L';
331
        }
332
        //COLOCA RAZÃO SOCIAL
333
        $texto = $emitRazao;
334
        $texto = $texto . "\nCNPJ:" . $emitCnpj;
335
        $texto = $texto . "\nIE:" . $emitIE;
336
        if (!empty($emitIM)) {
337
            $texto = $texto . " - IM:" . $emitIM;
338
        }
339
        $texto = $texto . "\n" . $emitLgr . "," . $emitNro . " " . $emitCpl . "," . $emitBairro
340
                . ". CEP:" . $emitCEP . ". " . $emitMun . "-" . $emitUF . $emitFone;
341
        $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
342
        $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...
343
    }
344
    
345
    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...
346
    {
347
        $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...
348
        $maxW = $this->wPrint;
349
        $w = ($maxW*1);
350
        $hBox1 = 7;
351
        $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
352
        $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
353
        $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...
354
        $hBox2 = 4;
355
        $yBox2 = $y + $hBox1;
356
        $texto = "\nNFC-e não permite aproveitamento de crédito de ICMS";
357
        $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
358
        $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...
359
    }
360
    
361
    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...
362
    {
363
        $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...
364
        $maxW = $this->wPrint;
365
        $qtdItens = $this->det->length;
366
        $w = ($maxW*1);
367
        $hLinha = $this->hLinha;
368
        $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
369
        $wBoxCod = $w*0.17;
370
        $texto = "CÓDIGO";
371
        $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...
372
        $wBoxDescricao = $w*0.43;
373
        $xBoxDescricao = $wBoxCod + $x;
374
        $texto = "DESCRICÃO";
375
        $this->pdf->textBox(
376
            $xBoxDescricao,
377
            $y,
378
            $wBoxDescricao,
379
            $hLinha,
380
            $texto,
381
            $aFontCabProdutos,
382
            'T',
383
            'L',
384
            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...
385
            '',
386
            false
387
        );
388
        $wBoxQt = $w*0.08;
389
        $xBoxQt = $wBoxDescricao + $xBoxDescricao;
390
        $texto = "QT";
391
        $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...
392
        $wBoxUn = $w*0.06;
393
        $xBoxUn = $wBoxQt + $xBoxQt;
394
        $texto = "UN";
395
        $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...
396
        $wBoxVl = $w*0.13;
397
        $xBoxVl = $wBoxUn + $xBoxUn;
398
        $texto = "VALOR";
399
        $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...
400
        $wBoxTotal = $w*0.13;
401
        $xBoxTotal = $wBoxVl + $xBoxVl;
402
        $texto = "TOTAL";
403
        $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...
404
        $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...
405
        $hMaxLinha = $this->hMaxLinha;
406
        $cont = 0;
407
        $aFontProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
408
        if ($qtdItens > 0) {
409
            foreach ($this->det as $detI) {
410
                $thisItem   = $detI;
411
                $prod       = $thisItem->getElementsByTagName("prod")->item(0);
412
                $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...
413
                $cProd      = $this->getTagValue($prod, "cProd");
414
                $xProd      = $this->getTagValue($prod, "xProd");
415
                $qCom       = number_format($this->getTagValue($prod, "qCom"), 2, ",", ".");
416
                $uCom       = $this->getTagValue($prod, "uCom");
417
                $vUnCom     = number_format($this->getTagValue($prod, "vUnCom"), 2, ",", ".");
418
                $vProd      = number_format($this->getTagValue($prod, "vProd"), 2, ",", ".");
419
                //COLOCA PRODUTO
420
                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
421
                //COLOCA PRODUTO CÓDIGO
422
                $wBoxCod = $w*0.17;
423
                $texto = $cProd;
424
                $this->pdf->textBox(
425
                    $x,
426
                    $yBoxProd,
427
                    $wBoxCod,
428
                    $hMaxLinha,
429
                    $texto,
430
                    $aFontProdutos,
431
                    'C',
432
                    'C',
433
                    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...
434
                    '',
435
                    false
436
                );
437
                //COLOCA PRODUTO DESCRIÇÃO
438
                $wBoxDescricao = $w*0.43;
439
                $xBoxDescricao = $wBoxCod + $x;
440
                $texto = $xProd;
441
                $this->pdf->textBox(
442
                    $xBoxDescricao,
443
                    $yBoxProd,
444
                    $wBoxDescricao,
445
                    $hMaxLinha,
446
                    $texto,
447
                    $aFontProdutos,
448
                    'C',
449
                    'L',
450
                    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...
451
                    '',
452
                    false
453
                );
454
                //COLOCA PRODUTO QUANTIDADE
455
                $wBoxQt = $w*0.08;
456
                $xBoxQt = $wBoxDescricao + $xBoxDescricao;
457
                $texto = $qCom;
458
                $this->pdf->textBox(
459
                    $xBoxQt,
460
                    $yBoxProd,
461
                    $wBoxQt,
462
                    $hMaxLinha,
463
                    $texto,
464
                    $aFontProdutos,
465
                    'C',
466
                    'C',
467
                    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...
468
                    '',
469
                    false
470
                );
471
                //COLOCA PRODUTO UNIDADE
472
                $wBoxUn = $w*0.06;
473
                $xBoxUn = $wBoxQt + $xBoxQt;
474
                $texto = $uCom;
475
                $this->pdf->textBox(
476
                    $xBoxUn,
477
                    $yBoxProd,
478
                    $wBoxUn,
479
                    $hMaxLinha,
480
                    $texto,
481
                    $aFontProdutos,
482
                    'C',
483
                    'C',
484
                    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...
485
                    '',
486
                    false
487
                );
488
                //COLOCA PRODUTO VL UNITÁRIO
489
                $wBoxVl = $w*0.13;
490
                $xBoxVl = $wBoxUn + $xBoxUn;
491
                $texto = $vUnCom;
492
                $this->pdf->textBox(
493
                    $xBoxVl,
494
                    $yBoxProd,
495
                    $wBoxVl,
496
                    $hMaxLinha,
497
                    $texto,
498
                    $aFontProdutos,
499
                    'C',
500
                    'R',
501
                    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...
502
                    '',
503
                    false
504
                );
505
                //COLOCA PRODUTO VL TOTAL
506
                $wBoxTotal = $w*0.13;
507
                $xBoxTotal = $wBoxVl + $xBoxVl;
508
                $texto = $vProd;
509
                $this->pdf->textBox(
510
                    $xBoxTotal,
511
                    $yBoxProd,
512
                    $wBoxTotal,
513
                    $hMaxLinha,
514
                    $texto,
515
                    $aFontProdutos,
516
                    'C',
517
                    'R',
518
                    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...
519
                    '',
520
                    false
521
                );
522
                
523
                $cont++;
524
            }
525
        }
526
    }
527
    
528
    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...
529
    {
530
        $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...
531
        $maxW = $this->wPrint;
532
        $hLinha = 3;
533
        $wColEsq = ($maxW*0.7);
534
        $wColDir = ($maxW*0.3);
535
        $xValor = $x + $wColEsq;
536
        $qtdItens = $this->det->length;
537
        $vProd = $this->getTagValue($this->ICMSTot, "vProd");
538
        $vNF = $this->getTagValue($this->ICMSTot, "vNF");
539
        $vDesc  = $this->getTagValue($this->ICMSTot, "vDesc");
540
        $vFrete = $this->getTagValue($this->ICMSTot, "vFrete");
541
        $vTotTrib = $this->getTagValue($this->ICMSTot, "vTotTrib");
542
        $texto = "Qtd. Total de Itens";
543
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
544
        $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...
545
        $texto = $qtdItens;
546
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
547
        $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...
548
        $yTotal = $y + ($hLinha);
549
        $texto = "Total de Produtos";
550
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
551
        $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...
552
        $texto = "R$ " . number_format($vProd, 2, ",", ".");
553
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
554
        $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...
555
        $yDesconto = $y + ($hLinha*2);
556
        $texto = "Descontos";
557
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
558
        $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...
559
        $texto = "R$ " . $vDesc;
560
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
561
        $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...
562
        $yFrete= $y + ($hLinha*3);
563
        $texto = "Frete";
564
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
565
        $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...
566
        $texto = "R$ " . $vFrete;
567
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
568
        $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...
569
        $yTotalFinal = $y + ($hLinha*4);
570
        $texto = "Total";
571
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
572
        $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...
573
        $texto = "R$ " . $vNF;
574
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
575
        $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...
576
        $yTotalFinal = $y + ($hLinha*5);
577
        $texto = "Informação dos Tributos Totais Incidentes";
578
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
579
        $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...
580
        $texto = "R$ " . $vTotTrib;
581
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
582
        $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...
583
    }
584
    
585
    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...
586
    {
587
        $y += 6;
588
        $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...
589
        $maxW = $this->wPrint;
590
        $qtdPgto = $this->pag->length;
591
        $w = ($maxW*1);
592
        $hLinha = $this->hLinha;
593
        $wColEsq = ($maxW*0.7);
594
        $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...
595
        $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...
596
        $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
597
        $wBoxEsq = $w*0.7;
598
        $texto = "FORMA DE PAGAMENTO";
599
        $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...
600
        $wBoxDir = $w*0.3;
601
        $xBoxDescricao = $x + $wBoxEsq;
602
        $texto = "VALOR PAGO";
603
        $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...
604
        $cont = 0;
605
        if ($qtdPgto > 0) {
606
            foreach ($this->pag as $pagI) {
607
                $tPag = $this->getTagValue($pagI, "tPag");
608
                $tPagNome = $this->tipoPag($tPag);
609
                $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...
610
                $vPag = number_format($this->getTagValue($pagI, "vPag"), 2, ",", ".");
611
                $card = $pagI->getElementsByTagName("card")->item(0);
612
                $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...
613
                $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...
614
                $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...
615
                if (isset($card)) {
616
                    $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...
617
                    $tBand    = $this->getTagValue($card, "tBand");
618
                    $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...
619
                    $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...
620
                }
621
                //COLOCA PRODUTO
622
                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
623
                //COLOCA PRODUTO CÓDIGO
624
                $texto = $tPagNome;
625
                $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...
626
                //COLOCA PRODUTO DESCRIÇÃO
627
                $xBoxDescricao = $wBoxEsq + $x;
628
                $texto = "R$ " . $vPag;
629
                $this->pdf->textBox(
630
                    $xBoxDescricao,
631
                    $yBoxProd,
632
                    $wBoxDir,
633
                    $hLinha,
634
                    $texto,
635
                    $aFontPgto,
636
                    'C',
637
                    'R',
638
                    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...
639
                    '',
640
                    false
641
                );
642
                $cont++;
643
            }
644
            
645
            if (!empty($this->vTroco)) {
646
                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
647
                //COLOCA PRODUTO CÓDIGO
648
                $texto = 'Troco';
649
                $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...
650
                //COLOCA PRODUTO DESCRIÇÃO
651
                $xBoxDescricao = $wBoxEsq + $x;
652
                $texto = "R$ " . number_format($this->vTroco, 2, ",", ".");
653
                $this->pdf->textBox(
654
                    $xBoxDescricao,
655
                    $yBoxProd,
656
                    $wBoxDir,
657
                    $hLinha,
658
                    $texto,
659
                    $aFontPgto,
660
                    'C',
661
                    'R',
662
                    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...
663
                    '',
664
                    false
665
                );
666
            }
667
        }
668
    }
669
    
670
    protected function fiscalDANFE($x = 0, $y = 0, $h = 0)
671
    {
672
        $y += 6;
673
        $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...
674
        $maxW = $this->wPrint;
675
        $w = ($maxW*1);
676
        $hLinha = $this->hLinha;
677
        $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
678
        $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
679
        $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...
680
        $chNFe = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
681
        $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...
682
        
683
        if ($this->checkCancelada()) {
684
            //101 Cancelamento
685
            $this->pdf->setTextColor(255, 0, 0);
686
            $texto = "NFCe CANCELADA";
687
            $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...
688
            $this->pdf->setTextColor(0, 0, 0);
689
        }
690
        
691
        if ($this->checkDenegada()) {
692
            //uso denegado
693
            $this->pdf->setTextColor(255, 0, 0);
694
            $texto = "NFCe CANCELADA";
695
            $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...
696
            $this->pdf->SetTextColor(0, 0, 0);
697
        }
698
        
699
        $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...
700
        $nNF = $this->getTagValue($this->ide, 'nNF');
701
        $serieNF = str_pad($this->getTagValue($this->ide, "serie"), 3, "0", STR_PAD_LEFT);
702
        $dhEmi = $this->getTagValue($this->ide, "dhEmi");
703
        $dhEmilocal = new \DateTime($dhEmi);
704
        $dhEmiLocalFormat = $dhEmilocal->format('d/m/Y H:i:s');
705
        $texto = "ÁREA DE MENSAGEM FISCAL";
706
        $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...
707
        $yTex1 = $y + ($hLinha*1);
708
        $hTex1 = $hLinha*2;
709
        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmiLocalFormat . " - Via Consumidor";
710
        $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...
711
        $yTex2 = $y + ($hLinha*3);
712
        $hTex2 = $hLinha*2;
713
        
714
        $texto = !empty($this->urlChave) ? "Consulte pela Chave de Acesso em " . $this->urlChave : '';
715
        $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...
716
        $texto = "CHAVE DE ACESSO";
717
        $yTit2 = $y + ($hLinha*5);
718
        $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...
719
        $yTex3 = $y + ($hLinha*6);
720
        $texto = $chNFe;
721
        $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...
722
    }
723
    
724
    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...
725
    {
726
        $y += 6;
727
        $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...
728
        $maxW = $this->wPrint;
729
        $w = ($maxW*1);
730
        $hLinha = $this->hLinha;
731
        $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
732
        $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
733
        $texto = "CONSUMIDOR";
734
        $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...
735
        if (isset($this->dest)) {
736
            $considEstrangeiro = !empty($this->dest->getElementsByTagName("idEstrangeiro")->item(0)->nodeValue)
737
                    ? $this->dest->getElementsByTagName("idEstrangeiro")->item(0)->nodeValue
738
                    : '';
739
            $consCPF = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
740
                    ? $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue
741
                    : '';
742
            $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
743
                    ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
744
                    : '';
745
            $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...
746
            $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
747
            $consNome = $this->getTagValue($this->dest, "xNome");
748
            $consLgr = $this->getTagValue($enderDest, "xLgr");
749
            $consNro = $this->getTagValue($enderDest, "nro");
750
            $consCpl = $this->getTagValue($enderDest, "xCpl", " - ");
751
            $consBairro = $this->getTagValue($enderDest, "xBairro");
752
            $consCEP = $this->formatField($this->getTagValue($enderDest, "CEP"));
753
            $consMun = $this->getTagValue($enderDest, "xMun");
754
            $consUF = $this->getTagValue($enderDest, "UF");
755
            $considEstrangeiro = $this->getTagValue($this->dest, "idEstrangeiro");
756
            $consCPF = $this->getTagValue($this->dest, "CPF");
757
            $consCNPJ = $this->getTagValue($this->dest, "CNPJ");
758
            $consDoc = "";
759
            if (!empty($consCNPJ)) {
760
                $consDoc = "CNPJ: $consCNPJ";
761
            } elseif (!empty($consCPF)) {
762
                $consDoc = "CPF: $consCPF";
763
            } elseif (!empty($considEstrangeiro)) {
764
                $consDoc = "id: $considEstrangeiro";
765
            }
766
            $consEnd = "";
767
            if (!empty($consLgr)) {
768
                $consEnd = $consLgr
769
                    . ","
770
                    . $consNro
771
                    . " "
772
                    . $consCpl
773
                    . ","
774
                    . $consBairro
775
                    . ". CEP:"
776
                    . $consCEP
777
                    . ". "
778
                    . $consMun
779
                    . "-"
780
                    . $consUF;
781
            }
782
            $yTex1 = $y + $hLinha;
783
            $texto = $consNome;
784
            if (!empty($consDoc)) {
785
                $texto .= " - ". $consDoc . "\n" . $consEnd;
786
                $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...
787
            }
788
        } else {
789
            $yTex1 = $y + $hLinha;
790
            $texto = "Consumidor não identificado";
791
            $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...
792
        }
793
    }
794
    
795
    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...
796
    {
797
        $y += 6;
798
        $margemInterna = $this->margemInterna;
799
        $maxW = $this->wPrint;
800
        $w = ($maxW*1)+4;
801
        $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...
802
        $hBoxLinha = $this->hBoxLinha;
803
        $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...
804
        $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
805
        $dhRecbto = '';
806
        $nProt = '';
807
        if (isset($this->nfeProc)) {
808
            $nProt = $this->getTagValue($this->nfeProc, "nProt");
809
            $dhRecbto  = $this->getTagValue($this->nfeProc, "dhRecbto");
810
        }
811
        $barcode = new Barcode();
812
        $bobj = $barcode->getBarcodeObj(
813
            'QRCODE,M',
814
            $this->qrCode,
815
            -4,
816
            -4,
817
            'black',
818
            array(-2, -2, -2, -2)
819
        )->setBackgroundColor('white');
820
        $qrcode = $bobj->getPngData();
821
        $wQr = 50;
822
        $hQr = 50;
823
        $yQr = ($y+$margemInterna);
824
        $xQr = ($w/2) - ($wQr/2);
825
        // prepare a base64 encoded "data url"
826
        $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
827
        $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...
828
        $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
829
        $dt = new DateTime($dhRecbto);
830
        $yQr = ($yQr+$hQr+$margemInterna);
831
        $this->pdf->textBox($x, $yQr, $w-4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
832
            . $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...
833
    }
834
   
835
    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...
836
    {
837
        $y += 17;
838
        $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...
839
        $maxW = $this->wPrint;
840
        $w = ($maxW * 1);
841
        $hLinha = $this->hLinha;
842
        $aFontTit = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
843
        $aFontTex = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
844
        // seta o textbox do titulo
845
        $texto = "INFORMAÇÃO ADICIONAL";
846
        if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")->length) {
847
            $y += 3;
848
            $msg = $this->nfeProc->getElementsByTagName("xMsg")->item(0)->nodeValue;
849
            $msg = str_replace('|', "\n", $msg);
850
            $texto .= " {$msg}";
851
            $heigthText = $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...
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...
852
            $y += 4;
853
        } else {
854
            $heigthText = $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...
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...
855
        }
856
        // seta o textbox do texto adicional
857
        $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...
858
    }
859
    
860
    /**
861
     * anfavea
862
     * Função para transformar o campo cdata do padrão ANFAVEA para
863
     * texto imprimível
864
     *
865
     * @param  string $cdata campo CDATA
866
     * @return string conteúdo do campo CDATA como string
867
     */
868
    protected function anfaveaDANFE($cdata = '')
869
    {
870
        if ($cdata == '') {
871
            return '';
872
        }
873
        //remove qualquer texto antes ou depois da tag CDATA
874
        $cdata = str_replace('<![CDATA[', '<CDATA>', $cdata);
875
        $cdata = str_replace(']]>', '</CDATA>', $cdata);
876
        $cdata = preg_replace('/\s\s+/', ' ', $cdata);
877
        $cdata = str_replace("> <", "><", $cdata);
878
        $len = strlen($cdata);
879
        $startPos = strpos($cdata, '<');
880
        if ($startPos === false) {
881
            return $cdata;
882
        }
883
        for ($x=$len; $x>0; $x--) {
884
            if (substr($cdata, $x, 1) == '>') {
885
                $endPos = $x;
886
                break;
887
            }
888
        }
889
        if ($startPos > 0) {
890
            $parte1 = substr($cdata, 0, $startPos);
891
        } else {
892
            $parte1 = '';
893
        }
894
        $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...
895
        if ($endPos < $len) {
896
            $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
897
        } else {
898
            $parte3 = '';
899
        }
900
        $texto = trim($parte1).' '.trim($parte3);
901
        if (strpos($parte2, '<CDATA>') === false) {
902
            $cdata = '<CDATA>'.$parte2.'</CDATA>';
903
        } else {
904
            $cdata = $parte2;
905
        }
906
        //carrega o xml CDATA em um objeto DOM
907
        $dom = new Dom();
908
        $dom->loadXML($cdata, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG);
909
        //$xml = $dom->saveXML();
910
        //grupo CDATA infADprod
911
        $id = $dom->getElementsByTagName('id')->item(0);
912
        $div = $dom->getElementsByTagName('div')->item(0);
913
        $entg = $dom->getElementsByTagName('entg')->item(0);
914
        $dest = $dom->getElementsByTagName('dest')->item(0);
915
        $ctl = $dom->getElementsByTagName('ctl')->item(0);
916
        $ref = $dom->getElementsByTagName('ref')->item(0);
917
        if (isset($id)) {
918
            if ($id->hasAttributes()) {
919
                foreach ($id->attributes as $attr) {
920
                    $name = $attr->nodeName;
921
                    $value = $attr->nodeValue;
922
                    $texto .= " $name : $value";
923
                }
924
            }
925
        }
926
        if (isset($div)) {
927
            if ($div->hasAttributes()) {
928
                foreach ($div->attributes as $attr) {
929
                    $name = $attr->nodeName;
930
                    $value = $attr->nodeValue;
931
                    $texto .= " $name : $value";
932
                }
933
            }
934
        }
935
        if (isset($entg)) {
936
            if ($entg->hasAttributes()) {
937
                foreach ($entg->attributes as $attr) {
938
                    $name = $attr->nodeName;
939
                    $value = $attr->nodeValue;
940
                    $texto .= " $name : $value";
941
                }
942
            }
943
        }
944
        if (isset($dest)) {
945
            if ($dest->hasAttributes()) {
946
                foreach ($dest->attributes as $attr) {
947
                    $name = $attr->nodeName;
948
                    $value = $attr->nodeValue;
949
                    $texto .= " $name : $value";
950
                }
951
            }
952
        }
953
        if (isset($ctl)) {
954
            if ($ctl->hasAttributes()) {
955
                foreach ($ctl->attributes as $attr) {
956
                    $name = $attr->nodeName;
957
                    $value = $attr->nodeValue;
958
                    $texto .= " $name : $value";
959
                }
960
            }
961
        }
962
        if (isset($ref)) {
963
            if ($ref->hasAttributes()) {
964
                foreach ($ref->attributes as $attr) {
965
                    $name = $attr->nodeName;
966
                    $value = $attr->nodeValue;
967
                    $texto .= " $name : $value";
968
                }
969
            }
970
        }
971
        //grupo CADATA infCpl
972
        $t = $dom->getElementsByTagName('transmissor')->item(0);
973
        $r = $dom->getElementsByTagName('receptor')->item(0);
974
        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
975
        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
976
        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
977
        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
978
        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
979
        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
980
        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
981
        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
982
        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
983
        if (isset($t)) {
984
            if ($t->hasAttributes()) {
985
                $texto .= " Transmissor ";
986
                foreach ($t->attributes as $attr) {
987
                    $name = $attr->nodeName;
988
                    $value = $attr->nodeValue;
989
                    $texto .= " $name : $value";
990
                }
991
            }
992
        }
993
        if (isset($r)) {
994
            if ($r->hasAttributes()) {
995
                $texto .= " Receptor ";
996
                foreach ($r->attributes as $attr) {
997
                    $name = $attr->nodeName;
998
                    $value = $attr->nodeValue;
999
                    $texto .= " $name : $value";
1000
                }
1001
            }
1002
        }
1003
        return $texto;
1004
    }
1005
    
1006
    protected static function getCardName($tBand)
1007
    {
1008
        switch ($tBand) {
1009
            case '01':
1010
                $tBandNome = 'VISA';
1011
                break;
1012
            case '02':
1013
                $tBandNome = 'MASTERCARD';
1014
                break;
1015
            case '03':
1016
                $tBandNome = 'AMERICAM EXPRESS';
1017
                break;
1018
            case '04':
1019
                $tBandNome = 'SOROCRED';
1020
                break;
1021
            case '99':
1022
                $tBandNome = 'OUTROS';
1023
                break;
1024
            default:
1025
                $tBandNome = '';
1026
        }
1027
        return $tBandNome;
1028
    }
1029
      
1030
    protected function checkCancelada()
1031
    {
1032
        if (!isset($this->nfeProc)) {
1033
            return false;
1034
        }
1035
        $cStat = $this->getTagValue($this->nfeProc, "cStat");
1036
        return $cStat == '101' ||
1037
                $cStat == '151' ||
1038
                $cStat == '135' ||
1039
                $cStat == '155';
1040
    }
1041
1042
    protected function checkDenegada()
1043
    {
1044
        if (!isset($this->nfeProc)) {
1045
            return false;
1046
        }
1047
        //NÃO ERA NECESSÁRIO ESSA FUNÇÃO POIS SÓ SE USA
1048
        //1 VEZ NO ARQUIVO INTEIRO
1049
        $cStat = $this->getTagValue($this->nfeProc, "cStat");
1050
        return $cStat == '110' ||
1051
               $cStat == '301' ||
1052
               $cStat == '302';
1053
    }
1054
}
1055