Passed
Push — master ( 3b9395...084643 )
by
unknown
02:57
created

Dacte::statusCTe()   D

Complexity

Conditions 24
Paths 28

Size

Total Lines 56

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 600

Importance

Changes 0
Metric Value
cc 24
nc 28
nop 0
dl 0
loc 56
ccs 0
cts 56
cp 0
crap 600
rs 4.1666
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace NFePHP\DA\CTe;
4
5
/**
6
 * Classe para ageração do PDF da CTe, conforme regras e estruturas
7
 * estabelecidas pela SEFAZ.
8
 *
9
 * @category  Library
10
 * @package   nfephp-org/sped-da
11
 * @name      Dacte .php
12
 * @copyright 2009-2019 NFePHP
13
 * @license   http://www.gnu.org/licenses/lesser.html LGPL v3
14
 * @link      http://github.com/nfephp-org/sped-da for the canonical source repository
15
 * @author    Roberto L. Machado <linux dot rlm at gmail dot com>
16
 */
17
18
use Com\Tecnick\Barcode\Barcode;
19
use Exception;
20
use NFePHP\DA\Legacy\Dom;
21
use NFePHP\DA\Legacy\Pdf;
22
use NFePHP\DA\Common\DaCommon;
23
24
class Dacte extends DaCommon
25
{
26
27
    protected $yDados = 0;
28
    protected $xml;
29
    protected $errMsg = '';
30
    protected $errStatus = false;
31
32
    protected $dom;
33
    protected $infCte;
34
    protected $infCteComp;
35
    protected $infCteAnu;
36
    protected $chaveCTeRef;
37
    protected $tpCTe;
38
    protected $ide;
39
    protected $emit;
40
    protected $enderEmit;
41
    protected $rem;
42
    protected $enderReme;
43
    protected $dest;
44
    protected $enderDest;
45
    protected $exped;
46
    protected $enderExped;
47
    protected $receb;
48
    protected $enderReceb;
49
    protected $infCarga;
50
    protected $infQ;
51
    protected $seg;
52
    protected $modal;
53
    protected $rodo;
54
    protected $moto;
55
    protected $veic;
56
    protected $ferrov;
57
    protected $Comp;
58
    protected $infNF;
59
    protected $infNFe;
60
    protected $compl;
61
    protected $ICMS;
62
    protected $ICMSSN;
63
    protected $ICMSOutraUF;
64
    protected $imp;
65
    protected $toma4;
66
    protected $toma03;
67
    protected $tpEmis;
68
    protected $tpImp;
69
    protected $tpAmb;
70
    protected $vPrest;
71
    protected $textoAdic = '';
72
    protected $aquav;
73
    protected $detCont;
74
    protected $arrayCont = array();
75
    protected $idDocAntEle = [];
76
    protected $qrCodCTe;
77
    protected $infCTeMultimodal = [];
78
79
    protected $wAdic = 150;
80
    protected $formatNegrito;
81
    protected $preVisualizar;
82
    protected $flagDocOrigContinuacao;
83
    protected $flagDetContContinuacao;
84
    protected $arrayNFe = array();
85
    protected $totPag;
86
    protected $margemInterna = 0;
87
    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
88
89
    /**
90
     * __construct
91
     *
92
     * @param string $xml Arquivo XML da CTe
93
     */
94
    public function __construct(
95
        $xml = ''
96
    ) {
97
        $this->loadDoc($xml);
98
    }
99
100
    private function loadDoc($xml)
101
    {
102
        $this->xml = $xml;
103
        if (!empty($xml)) {
104
            $this->dom = new Dom();
105
            $this->dom->loadXML($this->xml);
106
            $this->cteProc = $this->dom->getElementsByTagName("cteProc")->item(0);
0 ignored issues
show
Bug introduced by
The property cteProc 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...
107
            if (empty($this->dom->getElementsByTagName("infCte")->item(0))) {
108
                throw new \Exception('Isso não é um CT-e.');
109
            }
110
            $this->infCte = $this->dom->getElementsByTagName("infCte")->item(0);
111
            $this->ide = $this->dom->getElementsByTagName("ide")->item(0);
112
            if ($this->getTagValue($this->ide, "mod") != '57') {
113
                throw new \Exception("O xml deve ser CT-e modelo 57.");
114
            }
115
            $this->tpCTe = $this->getTagValue($this->ide, "tpCTe");
116
            $this->emit = $this->dom->getElementsByTagName("emit")->item(0);
117
            $this->enderEmit = $this->dom->getElementsByTagName("enderEmit")->item(0);
118
            $this->rem = $this->dom->getElementsByTagName("rem")->item(0);
119
            $this->enderReme = $this->dom->getElementsByTagName("enderReme")->item(0);
120
            $this->dest = $this->dom->getElementsByTagName("dest")->item(0);
121
            $this->enderDest = $this->dom->getElementsByTagName("enderDest")->item(0);
122
            $this->exped = $this->dom->getElementsByTagName("exped")->item(0);
123
            $this->enderExped = $this->dom->getElementsByTagName("enderExped")->item(0);
124
            $this->receb = $this->dom->getElementsByTagName("receb")->item(0);
125
            $this->enderReceb = $this->dom->getElementsByTagName("enderReceb")->item(0);
126
            $this->infCarga = $this->dom->getElementsByTagName("infCarga")->item(0);
127
            $this->infQ = $this->dom->getElementsByTagName("infQ");
128
            $this->seg = $this->dom->getElementsByTagName("seg")->item(0);
129
            $this->rodo = $this->dom->getElementsByTagName("rodo")->item(0);
130
            $this->aereo = $this->dom->getElementsByTagName("aereo")->item(0);
0 ignored issues
show
Bug introduced by
The property aereo 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...
131
            $this->lota = $this->getTagValue($this->rodo, "lota");
0 ignored issues
show
Bug introduced by
The property lota 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...
132
            $this->moto = $this->dom->getElementsByTagName("moto")->item(0);
133
            $this->veic = $this->dom->getElementsByTagName("veic");
134
            $this->ferrov = $this->dom->getElementsByTagName("ferrov")->item(0);
135
            // adicionar outros modais
136
            $this->infCteComp = $this->dom->getElementsByTagName("infCteComp")->item(0);
137
            $this->infCteAnu = $this->dom->getElementsByTagName("infCteAnu")->item(0);
138
            if ($this->tpCTe == 1) {
139
                $this->chaveCTeRef = $this->getTagValue($this->infCteComp, "chCTe");
140
            } else {
141
                $this->chaveCTeRef = $this->getTagValue($this->infCteAnu, "chCte");
142
            }
143
            $this->vPrest = $this->dom->getElementsByTagName("vPrest")->item(0);
144
            $this->Comp = $this->dom->getElementsByTagName("Comp");
145
            $this->infNF = $this->dom->getElementsByTagName("infNF");
146
            $this->infNFe = $this->dom->getElementsByTagName("infNFe");
147
            $this->infOutros = $this->dom->getElementsByTagName("infOutros");
0 ignored issues
show
Bug introduced by
The property infOutros does not exist. Did you maybe forget to declare it?

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

class MyClass { }

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

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

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
148
            $this->idDocAntEle = $this->dom->getElementsByTagName("idDocAntEle");
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->dom->getElementsByTagName('idDocAntEle') of type object<DOMNodeList> is incompatible with the declared type array of property $idDocAntEle.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
149
            $this->infCTeMultimodal = $this->dom->getElementsByTagName("infCTeMultimodal");
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->dom->getElementsB...ame('infCTeMultimodal') of type object<DOMNodeList> is incompatible with the declared type array of property $infCTeMultimodal.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
150
            $this->compl = $this->dom->getElementsByTagName("compl");
151
            $this->ICMS = $this->dom->getElementsByTagName("ICMS")->item(0);
152
            $this->ICMSSN = $this->dom->getElementsByTagName("ICMSSN")->item(0);
153
            $this->ICMSOutraUF = $this->dom->getElementsByTagName("ICMSOutraUF")->item(0);
154
            $this->imp = $this->dom->getElementsByTagName("imp")->item(0);
155
            if (!empty($this->getTagValue($this->imp, "vTotTrib"))) {
156
                $textoAdic = number_format($this->getTagValue($this->imp, "vTotTrib"), 2, ",", ".");
157
                $this->textoAdic = "o valor aproximado de tributos incidentes sobre o preço deste serviço é de R$"
158
                    . $textoAdic;
159
            }
160
            $this->toma4 = $this->dom->getElementsByTagName("toma4")->item(0);
161
            $this->toma03 = $this->dom->getElementsByTagName("toma3")->item(0);
162
            //Tag tomador é identificado por toma03 na versão 2.00
163
            if ($this->infCte->getAttribute("versao") == "2.00") {
164
                $this->toma03 = $this->dom->getElementsByTagName("toma03")->item(0);
165
            }
166
            //modal aquaviário
167
            $this->aquav = $this->dom->getElementsByTagName("aquav")->item(0);
168
            if (!empty($this->aquav)) {
169
                $this->detCont = $this->aquav->getElementsByTagName("detCont");
170
            }
171
            $tomador = $this->getTagValue($this->toma03, "toma");
172
            //0-Remetente;1-Expedidor;2-Recebedor;3-Destinatário;4-Outros
173
            switch ($tomador) {
174
                case '0':
175
                    $this->toma = $this->rem;
0 ignored issues
show
Bug introduced by
The property toma 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...
176
                    $this->enderToma = $this->enderReme;
0 ignored issues
show
Bug introduced by
The property enderToma 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...
177
                    break;
178
                case '1':
179
                    $this->toma = $this->exped;
180
                    $this->enderToma = $this->enderExped;
181
                    break;
182
                case '2':
183
                    $this->toma = $this->receb;
184
                    $this->enderToma = $this->enderReceb;
185
                    break;
186
                case '3':
187
                    $this->toma = $this->dest;
188
                    $this->enderToma = $this->enderDest;
189
                    break;
190
                default:
191
                    $this->toma = $this->toma4;
192
                    $this->enderToma = $this->getTagValue($this->toma4, "enderToma");
193
                    break;
194
            }
195
            $this->tpEmis = $this->getTagValue($this->ide, "tpEmis");
196
            $this->tpImp = $this->getTagValue($this->ide, "tpImp");
197
            $this->tpAmb = $this->getTagValue($this->ide, "tpAmb");
198
            $this->tpCTe = $this->getTagValue($this->ide, "tpCTe");
199
            $this->qrCodCTe = $this->dom->getElementsByTagName('qrCodCTe')->item(0) ?
200
                $this->dom->getElementsByTagName('qrCodCTe')->item(0)->nodeValue : 'SEM INFORMAÇÃO DE QRCODE';
201
            $this->protCTe = $this->dom->getElementsByTagName("protCTe")->item(0);
0 ignored issues
show
Bug introduced by
The property protCTe 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...
202
            //01-Rodoviário; //02-Aéreo; //03-Aquaviário; //04-Ferroviário;//05-Dutoviário
203
            $this->modal = $this->getTagValue($this->ide, "modal");
204
        }
205
    }
206
207
    /**
208
     * montaDACTE
209
     * Esta função monta a DACTE conforme as informações fornecidas para a classe
210
     * durante sua construção.
211
     * A definição de margens e posições iniciais para a impressão são estabelecidas no
212
     * pelo conteúdo da funçao e podem ser modificados.
213
     *
214
     * @param string $orientacao (Opcional) Estabelece a orientação da
0 ignored issues
show
Bug introduced by
There is no parameter named $orientacao. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
215
     *                impressão (ex. P-retrato), se nada for fornecido será
216
     *                usado o padrão da NFe
217
     * @param string $papel (Opcional) Estabelece o tamanho do papel (ex. A4)
0 ignored issues
show
Bug introduced by
There is no parameter named $papel. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
218
     * @return string O ID da NFe numero de 44 digitos extraido do arquivo XML
219
     */
220
    protected function monta(
221
        $logo = ''
222
    ) {
223
        if (!empty($logo)) {
224
            $this->logomarca = $this->adjustImage($logo);
225
        }
226
        $this->pdf = '';
0 ignored issues
show
Documentation Bug introduced by
It seems like '' of type string is incompatible with the declared type object<NFePHP\DA\Legacy\Pdf> of property $pdf.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
227
        //pega o orientação do documento
228
        if (empty($this->orientacao)) {
229
            $this->orientacao = 'P';
230
            if ($this->tpImp == 2) {
231
                $this->orientacao = 'L';
232
            }
233
        }
234
        //instancia a classe pdf
235
        $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel);
0 ignored issues
show
Bug introduced by
It seems like $this->papel can also be of type array; however, NFePHP\DA\Legacy\Pdf::__construct() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
236
        // verifica se foi passa a fonte a ser usada
237
        $this->formatPadrao = array(
0 ignored issues
show
Bug introduced by
The property formatPadrao 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...
238
            'font' => $this->fontePadrao,
239
            'size' => 6,
240
            'style' => '');
241
        $this->formatNegrito = array(
242
            'font' => $this->fontePadrao,
243
            'size' => 7,
244
            'style' => 'B');
245
        if ($this->orientacao == 'P') {
246
            // margens do PDF
247
            $margSup = 2;
248
            $margEsq = 2;
249
            $margDir = 2;
250
            // posição inicial do relatorio
251
            $xInic = 1;
252
            $yInic = 1;
253
            if ($this->papel == 'A4') {
254
                //A4 210x297mm
255
                $maxW = 210;
256
                $maxH = 297;
257
            }
258
        } else {
259
            // margens do PDF
260
            $margSup = 3;
261
            $margEsq = 3;
262
            $margDir = 3;
263
            // posição inicial do relatorio
264
            $xInic = 5;
265
            $yInic = 5;
266
            if ($this->papel == 'A4') {
267
                //A4 210x297mm
268
                $maxH = 210;
269
                $maxW = 297;
270
                $this->wCanhoto = 25;
0 ignored issues
show
Bug introduced by
The property wCanhoto 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...
271
            }
272
        }
273
        //total inicial de paginas
274
        $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...
275
        //largura imprimivel em mm
276
        $this->wPrint = $maxW - ($margEsq + $xInic);
0 ignored issues
show
Bug introduced by
The variable $maxW 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...
Documentation Bug introduced by
The property $wPrint was declared of type double, but $maxW - ($margEsq + $xInic) 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...
277
        //comprimento imprimivel em mm
278
        $this->hPrint = $maxH - ($margSup + $yInic);
0 ignored issues
show
Bug introduced by
The variable $maxH 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...
Documentation Bug introduced by
The property $hPrint was declared of type double, but $maxH - ($margSup + $yInic) 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...
279
        // estabelece contagem de paginas
280
        $this->pdf->aliasNbPages();
281
        // fixa as margens
282
        $this->pdf->setMargins($margEsq, $margSup, $margDir);
283
        $this->pdf->setDrawColor(0, 0, 0);
284
        $this->pdf->setFillColor(255, 255, 255);
285
        // inicia o documento
286
        $this->pdf->Open();
287
        // adiciona a primeira página
288
        $this->pdf->addPage($this->orientacao, $this->papel);
0 ignored issues
show
Bug introduced by
It seems like $this->papel can also be of type array; however, NFePHP\DA\Legacy\FPDF\Fpdf::addPage() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
289
        $this->pdf->setLineWidth(0.1);
290
        $this->pdf->setTextColor(0, 0, 0);
291
        //calculo do numero de páginas ???
292
        $totPag = 1;
293
        //montagem da primeira página
294
        $pag = 1;
295
        $x = $xInic;
296
        $y = $yInic;
297
        //coloca o cabeçalho
298
        $y = $this->canhoto($x, $y);
299
        $y += 24;
300
        $r = $this->cabecalho($x, $y, $pag, $totPag);
0 ignored issues
show
Unused Code introduced by
$r 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...
301
        $y += 70;
302
        $r = $this->remetente($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
303
        $x = $this->wPrint * 0.5 + 2;
304
        $r = $this->destinatario($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
305
        $y += 19;
306
        $x = $xInic;
307
        $r = $this->expedidor($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
308
        $x = $this->wPrint * 0.5 + 2;
309
        $r = $this->recebedor($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
310
        $y += 19;
311
        $x = $xInic;
312
        $r = $this->tomador($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
313
        if ($this->tpCTe == '0') {
314
            //Normal
315
            $y += 10;
316
            $x = $xInic;
317
            $r = $this->descricaoCarga($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
318
            $y += 17;
319
            $x = $xInic;
320
            $r = $this->compValorServ($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
321
            $y += 25;
322
            $x = $xInic;
323
            $r = $this->impostos($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
324
            $y += 13;
325
            $x = $xInic;
326
            if ($this->modal == '3') {
327
                $r = $this->detCont($x, $y);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $r is correct as $this->detCont($x, $y) (which targets NFePHP\DA\CTe\Dacte::detCont()) 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
$r 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...
328
            } else {
329
                $r = $this->docOrig($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
330
            }
331
            if ($this->modal == '1') {
332
                if ($this->lota == 1) {
333
                    //$y += 24.95;
334
                    $y += 35;
335
                } else {
336
                    $y += 53;
337
                }
338
            } elseif ($this->modal == '2') {
339
                $y += 53;
340
            } elseif ($this->modal == '3') {
341
                if (!empty($this->detCont)) {
342
                    $y += 15;
343
                }
344
            } elseif ($this->modal == '6') {
345
                $y += 27.5;
346
            } else {
347
                $y += 24.95;
348
            }
349
            if ($this->modal != 3 && $this->modal != 6) {
350
                $x = $xInic;
351
                $r = $this->observacao($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
352
                $y = $y - 6;
353
            }
354
            switch ($this->modal) {
355
                case '1':
356
                    $y += 25.9;
357
                    $x = $xInic;
358
                    $r = $this->modalRod($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
359
                    break;
360
                case '2':
361
                    $y += 25.9;
362
                    $x = $xInic;
363
                    $r = $this->modalAereo($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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
                    break;
365
                case '3':
366
                    if (!empty($this->detCont)) {
367
                        $y += 17.9;
368
                    }
369
                    $x = $xInic;
370
                    $r = $this->modalAquaviario($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
371
                    $y += 37.5;
372
                    break;
373
                case '4':
374
                    $y += 17.9;
375
                    $x = $xInic;
376
                    $r = $this->modalFerr($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
377
                    break;
378
                case '5':
379
                    $y += 17.9;
380
                    $x = $xInic;
381
                    // TODO fmertins 31/10/14: este método não existe...
382
                    $r = $this->modalDutoviario($x, $y);
0 ignored issues
show
Bug introduced by
The method modalDutoviario() does not seem to exist on object<NFePHP\DA\CTe\Dacte>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Unused Code introduced by
$r 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...
383
                    break;
384
                case '6':
385
                    $x = $xInic;
386
                    $r = $this->modalMultimodal($x, $y);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $r is correct as $this->modalMultimodal($x, $y) (which targets NFePHP\DA\CTe\Dacte::modalMultimodal()) 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
$r 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...
387
                    $y += 12.1;
388
                    break;
389
            }
390
            if ($this->modal == '1') {
391
                if ($this->lota == 1) {
392
                    $y += 37;
393
                } else {
394
                    $y += 8.9;
395
                }
396
            } elseif ($this->modal == '2') {
397
                $y += 8.9;
398
            } elseif ($this->modal == '3') {
399
                $y += 42.05;
400
                $y += 42.05;
401
            } elseif ($this->modal == '6') {
402
                $y += 42.05;
403
            } else {
404
                $y += 37;
405
            }
406
        } else {
407
            //$r = $this->cabecalho(1, 1, $pag, $totPag);
408
            //Complementado
409
            $y += 10;
410
            $x = $xInic;
411
            $r = $this->docCompl($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
412
            $y += 80;
413
            $x = $xInic;
414
            $r = $this->compValorServ($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
415
            $y += 25;
416
            $x = $xInic;
417
            $r = $this->impostos($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
418
            $y += 13;
419
            $x = $xInic;
420
            $r = $this->observacao($x, $y);
0 ignored issues
show
Unused Code introduced by
$r 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...
421
            $y += 15;
422
        }
423
        $x = $xInic;
424
        if ($this->modal == 3) {
425
            if (!empty($this->detCont)) {
426
                $y -= 30;
427
            } else {
428
                $y -= 17.5;
429
            }
430
        }
431
        $r = $this->dadosAdic($x, $y, $pag, $totPag);
0 ignored issues
show
Unused Code introduced by
$r 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...
432
        //$y += 19;
433
        //$y += 11;
434
        //$y = $this->canhoto($x, $y);
435
        //coloca o rodapé da página
436
        if ($this->orientacao == 'P') {
437
            $this->rodape(2, $this->hPrint - 2);
438
        } else {
439
            $this->rodape($xInic, $this->hPrint + 2.3);
440
        }
441
        if ($this->modal == 3) {
442
            if ($this->flagDetContContinuacao == 1) {
443
                $this->detContContinuacao(1, 71);
444
            } elseif ($this->flagDocOrigContinuacao == 1) {
445
                $this->docOrigContinuacao(1, 71);
446
            }
447
        } else {
448
            if ($this->flagDocOrigContinuacao == 1) {
449
                $this->docOrigContinuacao(1, 71);
450
            }
451
        }
452
    }
453
454
    /**
455
     * cabecalho
456
     * Monta o cabelhalho da DACTE ( retrato e paisagem )
457
     *
458
     * @param number $x Posição horizontal inicial, canto esquerdo
459
     * @param number $y Posição vertical inicial, canto superior
460
     * @param number $pag Número da Página
461
     * @param number $totPag Total de páginas
462
     * @return number Posição vertical final
463
     */
464
    protected function cabecalho($x = 0, $y = 0, $pag = '1', $totPag = '1')
465
    {
466
        $oldX = $x;
467
        $oldY = $y;
468
        if ($this->orientacao == 'P') {
469
            $maxW = $this->wPrint;
470
        } else {
471
            if ($pag == 1) {
472
                // primeira página
473
                $maxW = $this->wPrint - $this->wCanhoto;
474
            } else {
475
                // páginas seguintes
476
                $maxW = $this->wPrint;
477
            }
478
        }
479
        //##################################################################
480
        //coluna esquerda identificação do emitente
481
        //$w = round($maxW * 0.42);
482
        $w = round($maxW * 0.32);
483
        if ($this->orientacao == 'P') {
484
            $aFont = array(
0 ignored issues
show
Unused Code introduced by
$aFont 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...
485
                'font' => $this->fontePadrao,
486
                'size' => 6,
487
                'style' => '');
488
        } else {
489
            $aFont = $this->formatNegrito;
0 ignored issues
show
Unused Code introduced by
$aFont 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...
490
        }
491
        $w1 = $w;
0 ignored issues
show
Unused Code introduced by
$w1 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...
492
        $h = 35;
493
        $oldY += $h;
494
        //desenha a caixa
495
        $this->pdf->textBox($x, $y, $w + 2, $h + 1);
496
        // coloca o logo
497
        if (!empty($this->logomarca)) {
498
            $logoInfo = getimagesize($this->logomarca);
499
            //largura da imagem em mm
500
            $logoWmm = ($logoInfo[0] / 72) * 25.4;
501
            //altura da imagem em mm
502
            $logoHmm = ($logoInfo[1] / 72) * 25.4;
503
            if ($this->logoAlign == 'L') {
504
                $nImgW = round($w / 3, 0);
505
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
506
                $xImg = $x + 1;
507
                $yImg = round(($h - $nImgH) / 2, 0) + $y;
508
                //estabelecer posições do texto
509
                $x1 = round($xImg + $nImgW + 1, 0);
510
                $y1 = round($h / 3 + $y, 0);
511
                $tw = round(2 * $w / 3, 0);
512
            } elseif ($this->logoAlign == 'C') {
513
                $nImgH = round($h / 3, 0);
514
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
515
                $xImg = round(($w - $nImgW) / 2 + $x, 0);
516
                $yImg = $y + 3;
517
                $x1 = $x;
518
                $y1 = round($yImg + $nImgH + 1, 0);
519
                $tw = $w;
520
            } elseif ($this->logoAlign == 'R') {
521
                $nImgW = round($w / 3, 0);
522
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
523
                $xImg = round($x + ($w - (1 + $nImgW)), 0);
524
                $yImg = round(($h - $nImgH) / 2, 0) + $y;
525
                $x1 = $x;
526
                $y1 = round($h / 3 + $y, 0);
527
                $tw = round(2 * $w / 3, 0);
528
            }
529
            $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
0 ignored issues
show
Bug introduced by
The variable $xImg 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...
Bug introduced by
The variable $yImg 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...
Bug introduced by
The variable $nImgW 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...
Bug introduced by
The variable $nImgH 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...
530
        } else {
531
            $x1 = $x;
532
            $y1 = round($h / 3 + $y, 0);
533
            $tw = $w;
534
        }
535
        //Nome emitente
536
        $aFont = array(
537
            'font' => $this->fontePadrao,
538
            'size' => 9,
539
            'style' => 'B');
540
        $texto = $this->getTagValue($this->emit, "xNome");
541
        $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Bug introduced by
The variable $x1 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...
Bug introduced by
The variable $y1 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...
Bug introduced by
The variable $tw 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...
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...
542
        //endereço
543
        $y1 = $y1 + 3;
544
        $aFont = array(
545
            'font' => $this->fontePadrao,
546
            'size' => 7,
547
            'style' => '');
548
        $fone = $this->getTagValue($this->enderEmit, "fone") != "" ? $this->formatFone($this->enderEmit) : '';
0 ignored issues
show
Documentation introduced by
$this->enderEmit is of type object<DOMNode>, 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...
549
        $lgr = $this->getTagValue($this->enderEmit, "xLgr");
550
        $nro = $this->getTagValue($this->enderEmit, "nro");
551
        $cpl = $this->getTagValue($this->enderEmit, "xCpl");
0 ignored issues
show
Unused Code introduced by
$cpl 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...
552
        $bairro = $this->getTagValue($this->enderEmit, "xBairro");
553
        $CEP = $this->getTagValue($this->enderEmit, "CEP");
554
        $CEP = $this->formatField($CEP, "#####-###");
555
        $mun = $this->getTagValue($this->enderEmit, "xMun");
556
        $UF = $this->getTagValue($this->enderEmit, "UF");
557
        $xPais = $this->getTagValue($this->enderEmit, "xPais");
558
        $texto = $lgr . "," . $nro . "\n" . $bairro . " - "
559
            . $CEP . " - " . $mun . " - " . $UF . " " . $xPais
560
            . "\n  Fone/Fax: " . $fone;
561
        $this->pdf->textBox($x1 - 5, $y1 + 2, $tw + 5, 8, $texto, $aFont, 'T', '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...
562
        //CNPJ/CPF IE
563
        $cpfCnpj = $this->formatCNPJCPF($this->emit);
0 ignored issues
show
Documentation introduced by
$this->emit is of type object<DOMNode>, 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...
564
        $ie = $this->getTagValue($this->emit, "IE");
565
        $texto = 'CNPJ/CPF:  ' . $cpfCnpj . '     Insc.Estadual: ' . $ie;
566
        $this->pdf->textBox($x1 - 1, $y1 + 12, $tw + 5, 8, $texto, $aFont, 'T', '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...
567
        //outra caixa
568
        $h1 = 17.5;
569
        $y1 = $y + $h + 1;
570
        $this->pdf->textBox($x, $y1, $w + 2, $h1);
571
        //TIPO DO CT-E
572
        $texto = 'TIPO DO CTE';
573
        //$wa = 37;
574
        $wa = 34;
575
        $aFont = array(
576
            'font' => $this->fontePadrao,
577
            'size' => 8,
578
            'style' => '');
579
        $this->pdf->textBox($x, $y1, $w * 0.5, $h1, $texto, $aFont, 'T', '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...
580
        $tpCTe = $this->getTagValue($this->ide, "tpCTe");
581
        //0 - CT-e Normal,1 - CT-e de Complemento de Valores,
582
        //2 - CT-e de Anulação de Valores,3 - CT-e Substituto
583
        switch ($tpCTe) {
584
            case '0':
585
                $texto = 'Normal';
586
                break;
587
            case '1':
588
                $texto = 'Complemento de Valores';
589
                break;
590
            case '2':
591
                $texto = 'Anulação de Valores';
592
                break;
593
            case '3':
594
                $texto = 'Substituto';
595
                break;
596
            default:
597
                $texto = 'ERRO' . $tpCTe . $tpServ;
0 ignored issues
show
Bug introduced by
The variable $tpServ seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
598
        }
599
        $aFont = $this->formatNegrito;
600
        $this->pdf->textBox($x, $y1 + 3, $w * 0.5, $h1, $texto, $aFont, 'T', '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...
601
        //TIPO DO SERVIÇO
602
        $texto = 'TIPO DO SERVIÇO';
603
        $wb = 36;
0 ignored issues
show
Unused Code introduced by
$wb is not used, you could remove the assignment.

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

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

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

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

Loading history...
604
        $aFont = array(
605
            'font' => $this->fontePadrao,
606
            'size' => 8,
607
            'style' => '');
608
        $this->pdf->textBox($x + $wa, $y1, $w * 0.5, $h1, $texto, $aFont, 'T', '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...
609
        $tpServ = $this->getTagValue($this->ide, "tpServ");
610
        //0 - Normal;1 - Subcontratação;2 - Redespacho;3 - Redespacho Intermediário
611
        switch ($tpServ) {
612
            case '0':
613
                $texto = 'Normal';
614
                break;
615
            case '1':
616
                $texto = 'Subcontratação';
617
                break;
618
            case '2':
619
                $texto = 'Redespacho';
620
                break;
621
            case '3':
622
                $texto = 'Redespacho Intermediário';
623
                break;
624
            case '4':
625
                $texto = 'Serviço Vinculado a Multimodal';
626
                break;
627
            default:
628
                $texto = 'ERRO' . $tpServ;
629
        }
630
        $aFont = $this->formatNegrito;
631
        $this->pdf->textBox($x + $wa, $y1 + 3, $w * 0.5, $h1, $texto, $aFont, 'T', '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...
632
        $this->pdf->line($w * 0.5, $y1, $w * 0.5, $y1 + $h1);
633
        //TOMADOR DO SERVIÇO
634
        $texto = 'IND.DO CT-E GLOBALIZADO';
635
        $wc = 37;
0 ignored issues
show
Unused Code introduced by
$wc 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...
636
        $y2 = $y1 + 8;
637
        $aFont = array(
638
            'font' => $this->fontePadrao,
639
            'size' => 6,
640
            'style' => '');
641
        $this->pdf->textBox($x, $y2, $w * 0.5, $h1, $texto, $aFont, 'T', '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...
642
        $this->pdf->line($x, $y1 + 8, $w + 3, $y1 + 8);
643
        $toma = $this->getTagValue($this->ide, "indGlobalizado");
644
        //0-Remetente;1-Expedidor;2-Recebedor;3-Destinatário;4 - Outros
645
        if ($toma == 1) {
646
            $aFont = array(
647
                'font' => $this->fontePadrao,
648
                'size' => 11,
649
                'style' => '');
650
            $this->pdf->textBox($x - 14.5, $y2 + 3.5, $w * 0.5, $h1, 'X', $aFont, 'T', '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...
651
        } else {
652
            $aFont = array(
653
                'font' => $this->fontePadrao,
654
                'size' => 11,
655
                'style' => '');
656
            $this->pdf->textBox($x + 3.5, $y2 + 3.5, $w * 0.5, $h1, 'X', $aFont, 'T', '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...
657
        }
658
        $aFont = $this->formatNegrito;
659
        $this->pdf->line($x + 3, $y2 + 4, $x + 3, $y2 + 8);
660
        $this->pdf->line($x + 8, $y2 + 4, $x + 8, $y2 + 8);
661
        $this->pdf->line($x + 3, $y2 + 4, $x + 8, $y2 + 4);
662
        $this->pdf->line($x + 3, $y2 + 8, $x + 8, $y2 + 8);
663
        $this->pdf->textBox($x - 6, $y2 + 4.4, $w * 0.5, $h1, 'SIM', $aFont, 'T', '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...
664
        $this->pdf->line($x + 18, $y2 + 4, $x + 18, $y2 + 8);
665
        $this->pdf->line($x + 23, $y2 + 4, $x + 23, $y2 + 8);
666
        $this->pdf->line($x + 18, $y2 + 4, $x + 23, $y2 + 4);
667
        $this->pdf->line($x + 18, $y2 + 8, $x + 23, $y2 + 8);
668
        $this->pdf->textBox($x + 9.8, $y2 + 1.4 + 3, $w * 0.5, $h1, 'NÃO', $aFont, 'T', '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...
669
        //FORMA DE PAGAMENTO
670
        $texto = 'INF.DO CT-E GLOBALIZADO';
671
        $wd = 36;
0 ignored issues
show
Unused Code introduced by
$wd 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...
672
        $aFont = array(
673
            'font' => $this->fontePadrao,
674
            'size' => 8,
675
            'style' => '');
676
        $this->pdf->textBox($x + $wa, $y2 - 0.5, $w * 0.5, $h1, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
677
        $forma = $this->getTagValue($this->ide, "forPag");
0 ignored issues
show
Unused Code introduced by
$forma 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...
678
        //##################################################################
679
        //coluna direita
680
        $x += $w + 2;
681
        $w = round($maxW * 0.212);
682
        $w1 = $w;
683
        $h = 11;
684
        $this->pdf->textBox($x, $y, $w + 48.5, $h + 1);
685
        $texto = "DACTE";
686
        $aFont = array(
687
            'font' => $this->fontePadrao,
688
            'size' => 10,
689
            'style' => 'B');
690
        $this->pdf->textBox($x + 25, $y + 2, $w, $h, $texto, $aFont, 'T', '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...
691
        $aFont = array(
692
            'font' => $this->fontePadrao,
693
            'size' => 9,
694
            'style' => '');
695
        $texto = "Documento Auxiliar do Conhecimento de Transporte Eletrônico";
696
        $h = 10;
697
        $this->pdf->textBox($x + 5, $y + 6, $w + 40, $h, $texto, $aFont, 'T', '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...
698
        $x1 = $x + $w + 2;
699
        $w = round($maxW * 0.22, 0);
700
        $w2 = $w;
701
        $h = 11;
702
        $this->pdf->textBox($x1 + 46.5, $y, $w - 0.5, $h + 1);
703
        $texto = "MODAL";
704
        $aFont = array(
705
            'font' => $this->fontePadrao,
706
            'size' => 8,
707
            'style' => '');
708
        $this->pdf->textBox($x1 + 47, $y + 1, $w, $h, $texto, $aFont, 'T', '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...
709
        switch ($this->modal) {
710
            case '1':
711
                $texto = 'Rodoviário';
712
                break;
713
            case '2':
714
                $texto = 'Aéreo';
715
                break;
716
            case '3':
717
                $texto = 'Aquaviário';
718
                break;
719
            case '4':
720
                $texto = 'Ferroviário';
721
                break;
722
            case '5':
723
                $texto = 'Dutoviário';
724
                break;
725
        }
726
        $aFont = array(
727
            'font' => $this->fontePadrao,
728
            'size' => 10,
729
            'style' => 'B');
730
        $this->pdf->textBox($x1 + 47, $y + 5, $w, $h, $texto, $aFont, 'T', '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...
731
        //outra caixa
732
        $y += 12;
733
        $h = 9;
734
        $w = $w1 + $w2 + 2;
735
        $this->pdf->textBox($x, $y, $w + 0.5, $h + 1);
736
        //modelo
737
        $wa = 12;
738
        $xa = $x;
739
        $texto = 'MODELO';
740
        $aFont = array(
741
            'font' => $this->fontePadrao,
742
            'size' => 8,
743
            'style' => '');
744
        $this->pdf->textBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', '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...
745
        $texto = $this->getTagValue($this->ide, "mod");
746
        $aFont = $this->formatNegrito;
747
        $this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', '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...
748
        $this->pdf->line($x + $wa, $y, $x + $wa, $y + $h + 1);
749
        //serie
750
        $wa = 11;
751
        $xa += $wa;
752
        $texto = 'SÉRIE';
753
        $aFont = array(
754
            'font' => $this->fontePadrao,
755
            'size' => 8,
756
            'style' => '');
757
        $this->pdf->textBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', '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...
758
        $texto = $this->getTagValue($this->ide, "serie");
759
        $aFont = $this->formatNegrito;
760
        $this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', '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...
761
        $this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1);
762
        //numero
763
        $xa += $wa;
764
        $wa = 14;
765
        $texto = 'NÚMERO';
766
        $aFont = array(
767
            'font' => $this->fontePadrao,
768
            'size' => 8,
769
            'style' => '');
770
        $this->pdf->textBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', '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...
771
        $texto = $this->getTagValue($this->ide, "nCT");
772
        $aFont = $this->formatNegrito;
773
        $this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', '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...
774
        $this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1);
775
        //folha
776
        $xa += $wa;
777
        $wa = 6;
778
        $texto = 'FL';
779
        $aFont = array(
780
            'font' => $this->fontePadrao,
781
            'size' => 8,
782
            'style' => '');
783
        $this->pdf->textBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', '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...
784
        //$texto = '1/1';
785
        $texto = $pag . "/" . $totPag;
786
        $aFont = $this->formatNegrito;
787
        $this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', '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...
788
        $this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1);
789
        //data  hora de emissão
790
        $xa += $wa;
791
        $wa = 28;
792
        $texto = 'DATA E HORA DE EMISSÃO';
793
        $aFont = array(
794
            'font' => $this->fontePadrao,
795
            'size' => 8,
796
            'style' => '');
797
        $this->pdf->textBox($xa, $y + 1, $wa, $h, $texto, $aFont, 'T', '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...
798
        $texto = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
799
            date('d/m/Y H:i:s', strtotime($this->getTagValue($this->ide, "dhEmi"))) : '';
800
        $aFont = $this->formatNegrito;
801
        $this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', '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...
802
        $this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1);
803
        //ISUF
804
        $xa += $wa;
805
        $wa = 30;
806
        $texto = 'INSC.SUF.DO DEST';
807
        $aFont = $this->formatPadrao;
808
        $this->pdf->textBox($xa - 5, $y + 1, $wa, $h, $texto, $aFont, 'T', '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...
809
        $texto = $this->getTagValue($this->dest, "ISUF");
810
        $aFont = array(
811
            'font' => $this->fontePadrao,
812
            'size' => 7,
813
            'style' => 'B');
814
        $this->pdf->textBox($xa, $y + 5, $wa, $h, $texto, $aFont, 'T', '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...
815
        //outra caixa
816
        $y += $h + 1;
817
        $h = 23;
818
        $h1 = 14;
819
        $this->pdf->textBox($x, $y, $w + 0.5, $h1);
820
        //CODIGO DE BARRAS
821
        $chave_acesso = str_replace('CTe', '', $this->infCte->getAttribute("Id"));
822
        $bW = 85;
823
        $bH = 10;
824
        //codigo de barras
825
        $this->pdf->setFillColor(0, 0, 0);
826
        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
827
        $this->pdf->textBox($x, $y + $h1, $w + 0.5, $h1 - 6);
828
        $texto = 'CHAVE DE ACESSO';
829
        $aFont = $this->formatPadrao;
830
        $this->pdf->textBox($x, $y + $h1, $w, $h, $texto, $aFont, 'T', 'L', 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...
831
        $aFont = $this->formatNegrito;
832
        $texto = $this->formatField($chave_acesso, $this->formatoChave);
833
        $this->pdf->textBox($x, $y + $h1 + 3, $w, $h, $texto, $aFont, 'T', '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...
834
        $this->pdf->textBox($x, $y + $h1 + 8, $w + 0.5, $h1 - 4.5);
835
        $texto = "Consulta em http://www.cte.fazenda.gov.br/portal";
836
        if ($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) {
837
            $texto = "";
838
            $this->pdf->setFillColor(0, 0, 0);
839
            if ($this->tpEmis == 5) {
840
                $chaveContingencia = $this->geraChaveAdicCont();
841
                $this->pdf->code128($x + 20, $y1 + 10, $chaveContingencia, $bW * .9, $bH / 2);
842
            } else {
843
                $chaveContingencia = $this->getTagValue($this->protCTe, "nProt");
844
                $this->pdf->Code128($x + 40, $y1 + 10, $chaveContingencia, $bW * .4, $bH / 2);
845
            }
846
            //codigo de barras
847
        }
848
        $aFont = array(
849
            'font' => $this->fontePadrao,
850
            'size' => 8,
851
            'style' => '');
852
        $this->pdf->textBox($x, $y + $h1 + 11, $w, $h, $texto, $aFont, 'T', '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...
853
        //outra caixa
854
        $y += $h + 1;
855
        $h = 8.5;
856
        $wa = $w;
857
        $this->pdf->textBox($x, $y + 7.5, $w + 0.5, $h);
858
        if (!empty($this->numdepec)) {
859
            $texto = 'NÚMERO DE REGISTRO DPEC';
860
        } elseif ($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) {
861
            $texto = "DADOS DO CT-E";
862
        } else {
863
            $texto = 'PROTOCOLO DE AUTORIZAÇÃO DE USO';
864
        }
865
        $aFont = $this->formatPadrao;
866
        $this->pdf->textBox($x, $y + 7.5, $wa, $h, $texto, $aFont, 'T', 'L', 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...
867
        if (!empty($this->numdepec)) {
868
            $texto = $this->numdepec;
869
        } elseif ($this->tpEmis == 5) {
870
            $chaveContingencia = $this->geraChaveAdicCont();
871
            $aFont = array(
0 ignored issues
show
Unused Code introduced by
$aFont 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...
872
                'font' => $this->fontePadrao,
873
                'size' => 8,
874
                'style' => 'B');
875
            $texto = $this->formatField($chaveContingencia, "#### #### #### #### #### #### #### #### ####");
876
            $cStat = '';
0 ignored issues
show
Unused Code introduced by
$cStat 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...
877
        } else {
878
            $texto = $this->getTagValue($this->protCTe, "nProt") . " - ";
879
            if (!empty($this->protCTe)
880
                && !empty($this->protCTe->getElementsByTagName("dhRecbto")->item(0)->nodeValue)
881
            ) {
882
                $texto .= date(
883
                    'd/m/Y   H:i:s',
884
                    strtotime($this->getTagValue($this->protCTe, "dhRecbto"))
885
                );
886
            }
887
            $texto = $this->getTagValue($this->protCTe, "nProt") == '' ? '' : $texto;
888
        }
889
        $aFont = $this->formatNegrito;
890
        $this->pdf->textBox($x, $y + 12, $wa, $h, $texto, $aFont, 'T', '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...
891
        if ($this->qrCodCTe !== null) {
892
            $this->qrCodeDacte($y - 27);
893
            $w = 45;
894
            $x += 92.5;
895
            $this->pdf->textBox($x, $y - 34, $w + 0.5, $h + 41.5);
896
        }
897
        //CFOP
898
        $x = $oldX;
899
        $h = 8.5;
900
        $w = round($maxW * 0.32);
901
        $y1 = $y + 7.5;
902
        $this->pdf->textBox($x, $y1, $w + 2, $h);
903
        $texto = 'CFOP - NATUREZA DA PRESTAÇÃO';
904
        $aFont = array(
905
            'font' => $this->fontePadrao,
906
            'size' => 8,
907
            'style' => '');
908
        $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 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...
909
        $texto = $this->getTagValue($this->ide, "CFOP") . ' - ' . $this->getTagValue($this->ide, "natOp");
910
        $aFont = $this->formatNegrito;
911
        $this->pdf->textBox($x, $y1 + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 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...
912
        //ORIGEM DA PRESTAÇÃO
913
        $y += $h + 7.5;
914
        $x = $oldX;
915
        $h = 8;
916
        $w = ($maxW * 0.5);
917
        $this->pdf->textBox($x, $y, $w + 0.5, $h);
918
        $texto = 'INÍCIO DA PRESTAÇÃO';
919
        $aFont = array(
920
            'font' => $this->fontePadrao,
921
            'size' => 8,
922
            'style' => '');
923
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
924
        $texto = $this->getTagValue($this->ide, "xMunIni") . ' - ' . $this->getTagValue($this->ide, "UFIni");
925
        $aFont = $this->formatNegrito;
926
        $this->pdf->textBox($x, $y + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 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...
927
        //DESTINO DA PRESTAÇÃO
928
        $x = $oldX + $w + 1;
929
        $h = 8;
930
        $w = $w - 1.3;
931
        $this->pdf->textBox($x - 0.5, $y, $w + 0.5, $h);
932
        $texto = 'TÉRMINO DA PRESTAÇÃO';
933
        $aFont = array(
934
            'font' => $this->fontePadrao,
935
            'size' => 8,
936
            'style' => '');
937
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
938
        $texto = $this->getTagValue($this->ide, "xMunFim") . ' - ' . $this->getTagValue($this->ide, "UFFim");
939
        $aFont = $this->formatNegrito;
940
        $this->pdf->textBox($x, $y + 3.5, $w, $h, $texto, $aFont, 'T', 'L', 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...
941
        //#########################################################################
942
        //Indicação de CTe Homologação, cancelamento e falta de protocolo
943
        $resp = $this->statusCTe();
944
        if (!$resp['status']) {
945
            $n = count($resp['message']);
946
            $alttot = $n * 15;
947
            $x = 10;
948
            $y = $this->hPrint/2 - $alttot/2;
949
            $h = 15;
950
            $w = $maxW - (2 * $x);
951
            $this->pdf->settextcolor(90, 90, 90);
952
            foreach ($resp['message'] as $msg) {
0 ignored issues
show
Bug introduced by
The expression $resp['message'] of type boolean|array|string is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
953
                $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
954
                $this->pdf->textBox($x, $y, $w, $h, $msg, $aFont, '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...
955
                $y += $h;
956
            }
957
            $texto = $resp['submessage'];
958
            if (!empty($texto)) {
959
                $y += 3;
960
                $h = 5;
961
                $aFont = ['font' => $this->fontePadrao, 'size' => 20, 'style' => 'B'];
962
                $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, '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...
963
                $y += $h;
964
            }
965
            $y += 5;
966
            $w = $maxW - (2 * $x);
967
            $texto = "SEM VALOR FISCAL";
968
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
969
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, '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...
970
            $this->pdf->settextcolor(0, 0, 0);
971
        }
972
        return $oldY + 8;
973
    }
974
975
    /**
976
     * Verifica o status da CTe
977
     *
978
     * @return array
979
     */
980
    protected function statusCTe()
981
    {
982
        $resp = [
983
            'status' => true,
984
            'message' => [],
985
            'submessage' => ''
986
        ];
987
        if (!isset($this->cteProc)) {
988
            $resp['status'] = false;
989
            $resp['message'][] = 'CTe NÃO PROTOCOLADO';
990
        } elseif ($this->getTagValue($this->ide, "tpAmb") == '2' && $this->preVisualizar == '0') {
991
            $resp['status'] = false;
992
            $resp['message'][] =  "CTe EMITIDO EM HOMOLOGAÇÃO";
993
        } elseif ($this->preVisualizar == '1') {
994
            $resp['status'] = false;
995
            $resp['message'][] =  "PRÉ-VISUALIZAÇÃO";
996
        }
997
        $retEvento = $this->cteProc->getElementsByTagName('retEventoCTe')->item(0);
998
        $cStat = $this->getTagValue($this->cteProc, "cStat");
999
        if ($cStat == '110' ||
1000
            $cStat == '301' ||
1001
            $cStat == '302'
1002
        ) {
1003
            $resp['status'] = false;
1004
            $resp['message'][] = "CTe DENEGADO";
1005
        } elseif ($cStat == '101'
1006
            || $cStat == '151'
1007
            || $cStat == '135'
1008
            || $cStat == '155'
1009
            || $this->cancelFlag === true
1010
        ) {
1011
            $resp['status'] = false;
1012
            $resp['message'][] = "CTe CANCELADO";
1013
        } elseif (!empty($retEvento)) {
1014
            $infEvento = $retEvento->getElementsByTagName('infEvento')->item(0);
1015
            $cStat = $this->getTagValue($infEvento, "cStat");
1016
            $tpEvento= $this->getTagValue($infEvento, "tpEvento");
1017
            $dhEvento = date("d/m/Y H:i:s", $this->toTimestamp($this->getTagValue($infEvento, "dhRegEvento")));
1018
            $nProt = $this->getTagValue($infEvento, "nProt");
1019
            if ($tpEvento == '110111' && ($cStat == '101' || $cStat == '151' || $cStat == '135' || $cStat == '155')) {
1020
                $resp['status'] = false;
1021
                $resp['message'][] = "CTe CANCELADO";
1022
                $resp['submessage'] = "{$dhEvento} - {$nProt}";
1023
            }
1024
        } elseif (($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) && !empty($this->numdepec)) {
1025
            $resp['status'] = true;
1026
            $resp['message'][] = "CTe Emitido em Contingência";
1027
            $resp['message'][] = "devido à problemas técnicos";
1028
        } elseif ($this->tpEmis == 4) {
1029
            $resp['status'] = true;
1030
            $resp['message'][] = "CTe impresso em contingência -";
1031
            $resp['message'][] = "DPEC regularmente recebido pela Receita";
1032
            $resp['message'][] = "Federal do Brasil";
1033
        }
1034
        return $resp;
1035
    }
1036
1037
    /**
1038
     * rodapeDACTE
1039
     * Monta o rodape no final da DACTE ( retrato e paisagem )
1040
     *
1041
     * @param number $xInic Posição horizontal canto esquerdo
0 ignored issues
show
Bug introduced by
There is no parameter named $xInic. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
1042
     * @param number $yFinal Posição vertical final para impressão
0 ignored issues
show
Bug introduced by
There is no parameter named $yFinal. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
1043
     */
1044
    protected function rodape($x, $y)
1045
    {
1046
        $texto = "Impresso em  " . date('d/m/Y H:i:s') . ' ' . $this->creditos;
1047
        $w = $this->wPrint - 4;
1048
        $aFont = array(
1049
            'font' => $this->fontePadrao,
1050
            'size' => 6,
1051
            'style' => '');
1052
        $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 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...
1053
        $texto = '';
0 ignored issues
show
Unused Code introduced by
$texto 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...
1054
        $texto = $this->powered ? "Powered by NFePHP®" : '';
1055
        $aFont = array(
1056
            'font' => $this->fontePadrao,
1057
            'size' => 6,
1058
            'style' => '');
1059
        $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', false, '');
1060
    }
1061
1062
    /**
1063
     * remetente
1064
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1065
     *
1066
     * @param number $x Posição horizontal canto esquerdo
1067
     * @param number $y Posição vertical canto superior
1068
     * @return number Posição vertical final
1069
     */
1070
    protected function remetente($x = 0, $y = 0)
1071
    {
1072
        $oldX = $x;
1073
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
1074
        if ($this->orientacao == 'P') {
1075
            $maxW = $this->wPrint;
1076
        } else {
1077
            $maxW = $this->wPrint - $this->wCanhoto;
1078
        }
1079
        $w = $maxW * 0.5 + 0.5;
1080
        $h = 19;
1081
        $x1 = $x + 16;
1082
        $texto = 'REMETENTE';
1083
        $aFont = $this->formatPadrao;
1084
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', true, '');
1085
        $aFont = $this->formatNegrito;
1086
        $texto = $this->getTagValue($this->rem, "xNome");
1087
        $this->pdf->textBox($x1, $y, $w - 18, $h, $texto, $aFont, 'T', 'L', false, '', true);
1088
        $y += 3;
1089
        $texto = 'ENDEREÇO';
1090
        $aFont = $this->formatPadrao;
1091
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1092
        $aFont = $this->formatNegrito;
1093
        $texto = $this->getTagValue($this->enderReme, "xLgr") . ',';
1094
        $texto .= $this->getTagValue($this->enderReme, "nro");
1095
        $texto .= ($this->getTagValue($this->enderReme, "xCpl") != "") ?
1096
            ' - ' . $this->getTagValue($this->enderReme, "xCpl") : '';
1097
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1098
        $y += 3;
1099
        $texto = $this->getTagValue($this->enderReme, "xBairro");
1100
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1101
        $y += 3;
1102
        $texto = 'MUNICÍPIO';
1103
        $aFont = $this->formatPadrao;
1104
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1105
        $texto = $this->getTagValue($this->enderReme, "xMun") . ' - ';
1106
        $texto .= $this->getTagValue($this->enderReme, "UF");
1107
        $aFont = $this->formatNegrito;
1108
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1109
        $x = $w - 18;
1110
        $texto = 'CEP';
1111
        $aFont = $this->formatPadrao;
1112
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1113
        $texto = $this->formatField($this->getTagValue($this->enderReme, "CEP"), "#####-###");
1114
        $aFont = $this->formatNegrito;
1115
        $this->pdf->textBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1116
        $x = $oldX;
1117
        $y += 3;
1118
        $texto = 'CNPJ/CPF';
1119
        $aFont = $this->formatPadrao;
1120
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1121
        $cpfCnpj = $this->formatCNPJCPF($this->rem);
0 ignored issues
show
Documentation introduced by
$this->rem is of type object<DOMNode>, 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...
1122
        $aFont = $this->formatNegrito;
1123
        $this->pdf->textBox($x1, $y, $w, $h, $cpfCnpj, $aFont, 'T', 'L', 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...
1124
        $x = $w - 45;
1125
        $texto = 'INSCRIÇÃO ESTADUAL';
1126
        $aFont = $this->formatPadrao;
1127
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1128
        $texto = $this->getTagValue($this->rem, "IE");
1129
        $aFont = $this->formatNegrito;
1130
        $this->pdf->textBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1131
        $x = $oldX;
1132
        $y += 3;
1133
        $texto = 'PAÍS';
1134
        $aFont = $this->formatPadrao;
1135
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1136
        $texto = $this->getTagValue($this->rem, "xPais") != "" ?
1137
            $this->getTagValue($this->rem, "xPais") : 'BRASIL';
1138
        $aFont = $this->formatNegrito;
1139
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1140
        $x = $w - 25;
1141
        $texto = 'FONE';
1142
        $aFont = $this->formatPadrao;
1143
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1144
        //$texto = $this->formatFone($this->rem);
1145
        $texto = $this->getTagValue($this->rem, "fone") != "" ? $this->formatFone($this->rem) : '';
0 ignored issues
show
Documentation introduced by
$this->rem is of type object<DOMNode>, 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...
1146
        $aFont = $this->formatNegrito;
1147
        $this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1148
    }
1149
1150
    /**
1151
     * destinatario
1152
     * Monta o campo com os dados do destinatário na DACTE.
1153
     *
1154
     * @param number $x Posição horizontal canto esquerdo
1155
     * @param number $y Posição vertical canto superior
1156
     * @return number Posição vertical final
1157
     */
1158
    protected function destinatario($x = 0, $y = 0)
1159
    {
1160
        $oldX = $x;
1161
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
1162
        if ($this->orientacao == 'P') {
1163
            $maxW = $this->wPrint;
1164
        } else {
1165
            $maxW = $this->wPrint - $this->wCanhoto;
1166
        }
1167
        $w = ($maxW * 0.5) - 0.7;
1168
        $h = 19;
1169
        $x1 = $x + 19;
1170
        $texto = 'DESTINATÁRIO';
1171
        $aFont = $this->formatPadrao;
1172
        $this->pdf->textBox($x - 0.5, $y, $w, $h, $texto, $aFont, 'T', 'L', true, '');
1173
        $aFont = $this->formatNegrito;
1174
        $texto = $this->getTagValue($this->dest, "xNome");
1175
        $this->pdf->textBox($x1, $y, $w - 18, $h, $texto, $aFont, 'T', 'L', false, '', true);
1176
        $y += 3;
1177
        $texto = 'ENDEREÇO';
1178
        $aFont = $this->formatPadrao;
1179
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1180
        $aFont = $this->formatNegrito;
1181
        $texto = $this->getTagValue($this->enderDest, "xLgr") . ',';
1182
        $texto .= $this->getTagValue($this->enderDest, "nro");
1183
        $texto .= $this->getTagValue($this->enderDest, "xCpl") != "" ?
1184
            ' - ' . $this->getTagValue($this->enderDest, "xCpl") : '';
1185
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1186
        $y += 3;
1187
        $texto = $this->getTagValue($this->enderDest, "xBairro");
1188
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1189
        $y += 3;
1190
        $texto = 'MUNICÍPIO';
1191
        $aFont = $this->formatPadrao;
1192
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1193
        $texto = $this->getTagValue($this->enderDest, "xMun") . ' - ';
1194
        $texto .= $this->getTagValue($this->enderDest, "UF");
1195
        $aFont = $this->formatNegrito;
1196
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1197
        $x = $w - 19 + $oldX;
1198
        $texto = 'CEP';
1199
        $aFont = $this->formatPadrao;
1200
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1201
        $texto = $this->formatField($this->getTagValue($this->enderDest, "CEP"), "#####-###");
1202
        $aFont = $this->formatNegrito;
1203
        $this->pdf->textBox($x + 5, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1204
        $x = $oldX;
1205
        $y += 3;
1206
        $texto = 'CNPJ/CPF';
1207
        $aFont = $this->formatPadrao;
1208
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1209
        $cpfCnpj = $this->formatCNPJCPF($this->dest);
0 ignored issues
show
Documentation introduced by
$this->dest is of type object<DOMNode>, 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...
1210
        $aFont = $this->formatNegrito;
1211
        $this->pdf->textBox($x1, $y, $w, $h, $cpfCnpj, $aFont, 'T', 'L', 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...
1212
        $x = $w - 47.5 + $oldX;
1213
        $texto = 'INSCRIÇÃO ESTADUAL';
1214
        $aFont = $this->formatPadrao;
1215
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1216
        $texto = $this->getTagValue($this->dest, "IE");
1217
        $aFont = $this->formatNegrito;
1218
        $this->pdf->textBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1219
        $x = $oldX;
1220
        $y += 3;
1221
        $texto = 'PAÍS';
1222
        $aFont = $this->formatPadrao;
1223
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1224
        $texto = $this->getTagValue($this->dest, "xPais");
1225
        $aFont = $this->formatNegrito;
1226
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1227
        $x = $w - 27 + $oldX;
1228
        $texto = 'FONE';
1229
        $aFont = $this->formatPadrao;
1230
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1231
        //$texto = $this->formatFone($this->dest);
1232
        $texto = $this->getTagValue($this->dest, "fone") != "" ? $this->formatFone($this->dest) : '';
0 ignored issues
show
Documentation introduced by
$this->dest is of type object<DOMNode>, 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...
1233
        $aFont = $this->formatNegrito;
1234
        $this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1235
    }
1236
1237
    /**
1238
     * expedidor
1239
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1240
     *
1241
     * @param number $x Posição horizontal canto esquerdo
1242
     * @param number $y Posição vertical canto superior
1243
     * @return number Posição vertical final
1244
     */
1245
    protected function expedidor($x = 0, $y = 0)
1246
    {
1247
        $oldX = $x;
1248
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
1249
        if ($this->orientacao == 'P') {
1250
            $maxW = $this->wPrint;
1251
        } else {
1252
            $maxW = $this->wPrint - $this->wCanhoto;
1253
        }
1254
        $w = $maxW * 0.5 + 0.5;
1255
        $h = 19;
1256
        $x1 = $x + 16;
1257
        $texto = 'EXPEDIDOR';
1258
        $aFont = $this->formatPadrao;
1259
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
1260
        $aFont = $this->formatNegrito;
1261
        $texto = $this->getTagValue($this->exped, "xNome");
1262
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1263
        $y += 3;
1264
        $texto = 'ENDEREÇO';
1265
        $aFont = $this->formatPadrao;
1266
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1267
        $aFont = $this->formatNegrito;
1268
        if (isset($this->enderExped)) {
1269
            $texto = $this->getTagValue($this->enderExped, "xLgr") . ', ';
1270
            $texto .= $this->getTagValue($this->enderExped, "nro");
1271
            $texto .= $this->getTagValue($this->enderExped, "xCpl") != "" ?
1272
                ' - ' . $this->getTagValue($this->enderExped, "xCpl") :
1273
                '';
1274
        } else {
1275
            $texto = '';
1276
        }
1277
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1278
        $y += 3;
1279
        $texto = $this->getTagValue($this->enderExped, "xBairro");
0 ignored issues
show
Bug introduced by
It seems like $this->enderExped can be null; however, getTagValue() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
1280
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1281
        $y += 3;
1282
        $texto = 'MUNICÍPIO';
1283
        $aFont = $this->formatPadrao;
1284
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1285
        if (isset($this->enderExped)) {
1286
            $texto = $this->getTagValue($this->enderExped, "xMun") . ' - ';
1287
            $texto .= $this->getTagValue($this->enderExped, "UF");
1288
        } else {
1289
            $texto = '';
1290
        }
1291
        $aFont = $this->formatNegrito;
1292
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1293
        $x = $w - 18;
1294
        $texto = 'CEP';
1295
        $aFont = $this->formatPadrao;
1296
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1297
        $texto = $this->formatField($this->getTagValue($this->enderExped, "CEP"), "#####-###");
0 ignored issues
show
Bug introduced by
It seems like $this->enderExped can be null; however, getTagValue() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
1298
        $aFont = $this->formatNegrito;
1299
        $this->pdf->textBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1300
        $x = $oldX;
1301
        $y += 3;
1302
        $texto = 'CNPJ/CPF';
1303
        $aFont = $this->formatPadrao;
1304
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1305
        $cpfCnpj = $this->formatCNPJCPF($this->exped);
0 ignored issues
show
Documentation introduced by
$this->exped is of type object<DOMNode>, 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...
1306
        $aFont = $this->formatNegrito;
1307
        $this->pdf->textBox($x1, $y, $w, $h, $cpfCnpj, $aFont, 'T', 'L', 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...
1308
        $x = $w - 45;
1309
        $texto = 'INSCRIÇÃO ESTADUAL';
1310
        $aFont = $this->formatPadrao;
1311
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1312
        $texto = $this->getTagValue($this->exped, "IE");
1313
        $aFont = $this->formatNegrito;
1314
        $this->pdf->textBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1315
        $x = $oldX;
1316
        $y += 3;
1317
        $texto = 'PAÍS';
1318
        $aFont = $this->formatPadrao;
1319
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1320
        $texto = $this->getTagValue($this->exped, "xPais");
1321
        $aFont = $this->formatNegrito;
1322
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1323
        $x = $w - 25;
1324
        $texto = 'FONE';
1325
        $aFont = $this->formatPadrao;
1326
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1327
        if (isset($this->exped)) {
1328
            $texto = $this->getTagValue($this->exped, "fone") != "" ? $this->formatFone($this->exped) : '';
0 ignored issues
show
Documentation introduced by
$this->exped is of type object<DOMNode>, 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...
1329
            $aFont = $this->formatNegrito;
1330
            $this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1331
        }
1332
    }
1333
1334
    /**
1335
     * recebedor
1336
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1337
     *
1338
     * @param number $x Posição horizontal canto esquerdo
1339
     * @param number $y Posição vertical canto superior
1340
     * @return number Posição vertical final
1341
     */
1342
    protected function recebedor($x = 0, $y = 0)
1343
    {
1344
        $oldX = $x;
1345
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
1346
        if ($this->orientacao == 'P') {
1347
            $maxW = $this->wPrint;
1348
        } else {
1349
            $maxW = $this->wPrint - $this->wCanhoto;
1350
        }
1351
        $w = ($maxW * 0.5) - 0.7;
1352
        $h = 19;
1353
        $x1 = $x + 19;
1354
        $texto = 'RECEBEDOR';
1355
        $aFont = $this->formatPadrao;
1356
        $this->pdf->textBox($x - 0.5, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
1357
        $aFont = $this->formatNegrito;
1358
        $texto = $this->getTagValue($this->receb, "xNome");
1359
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1360
        $y += 3;
1361
        $texto = 'ENDEREÇO';
1362
        $aFont = $this->formatPadrao;
1363
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1364
        $aFont = $this->formatNegrito;
1365
        if (isset($this->enderReceb)) {
1366
            $texto = $this->getTagValue($this->enderReceb, "xLgr") . ', ';
1367
            $texto .= $this->getTagValue($this->enderReceb, "nro");
1368
            $texto .= ($this->getTagValue($this->enderReceb, "xCpl") != "") ?
1369
                ' - ' . $this->getTagValue($this->enderReceb, "xCpl") :
1370
                '';
1371
        } else {
1372
            $texto = '';
1373
        }
1374
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1375
        $y += 3;
1376
        $texto = $this->getTagValue($this->enderReceb, "xBairro");
0 ignored issues
show
Bug introduced by
It seems like $this->enderReceb can be null; however, getTagValue() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
1377
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1378
        $y += 3;
1379
        $texto = 'MUNICÍPIO';
1380
        $aFont = $this->formatPadrao;
1381
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1382
        if (isset($this->enderReceb)) {
1383
            $texto = $this->getTagValue($this->enderReceb, "xMun") . ' - ';
1384
            $texto .= $this->getTagValue($this->enderReceb, "UF");
1385
        } else {
1386
            $texto = '';
1387
        }
1388
        $aFont = $this->formatNegrito;
1389
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1390
        $x = $w - 19 + $oldX;
1391
        $texto = 'CEP';
1392
        $aFont = $this->formatPadrao;
1393
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1394
        $texto = $this->formatField($this->getTagValue($this->enderReceb, "CEP"), "#####-###");
0 ignored issues
show
Bug introduced by
It seems like $this->enderReceb can be null; however, getTagValue() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
1395
        $aFont = $this->formatNegrito;
1396
        $this->pdf->textBox($x + 5, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1397
        $x = $oldX;
1398
        $y += 3;
1399
        $texto = 'CNPJ/CPF';
1400
        $aFont = $this->formatPadrao;
1401
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1402
        $texto = $this->formatCNPJCPF($this->receb);
0 ignored issues
show
Documentation introduced by
$this->receb is of type object<DOMNode>, 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...
1403
        $aFont = $this->formatNegrito;
1404
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1405
        $x = $w - 47 + $oldX;
1406
        $texto = 'INSCRIÇÃO ESTADUAL';
1407
        $aFont = $this->formatPadrao;
1408
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1409
        $texto = $this->getTagValue($this->receb, "IE");
1410
        $aFont = $this->formatNegrito;
1411
        $this->pdf->textBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1412
        $x = $oldX;
1413
        $y += 3;
1414
        $texto = 'PAÍS';
1415
        $aFont = $this->formatPadrao;
1416
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1417
        $texto = $this->getTagValue($this->receb, "xPais");
1418
        $aFont = $this->formatNegrito;
1419
        $this->pdf->textBox($x1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1420
        $x = $w - 27 + $oldX;
1421
        $texto = 'FONE';
1422
        $aFont = $this->formatPadrao;
1423
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1424
        if (isset($this->receb)) {
1425
            $texto = $this->getTagValue($this->receb, "fone") != "" ? $this->formatFone($this->receb) : '';
0 ignored issues
show
Documentation introduced by
$this->receb is of type object<DOMNode>, 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...
1426
            $aFont = $this->formatNegrito;
1427
            $this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1428
        }
1429
    }
1430
1431
    /**
1432
     * tomador
1433
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1434
     *
1435
     * @param number $x Posição horizontal canto esquerdo
1436
     * @param number $y Posição vertical canto superior
1437
     * @return number Posição vertical final
1438
     */
1439
    protected function tomador($x = 0, $y = 0)
1440
    {
1441
        $oldX = $x;
1442
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
1443
        if ($this->orientacao == 'P') {
1444
            $maxW = $this->wPrint;
1445
        } else {
1446
            $maxW = $this->wPrint - $this->wCanhoto;
1447
        }
1448
        $w = $maxW;
1449
        $h = 10;
1450
        $texto = 'TOMADOR DO SERVIÇO';
1451
        $aFont = $this->formatPadrao;
1452
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
1453
        $aFont = $this->formatNegrito;
1454
        $texto = $this->getTagValue($this->toma, "xNome");
1455
        $this->pdf->textBox($x + 29, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1456
        $x = $maxW * 0.60;
1457
        $texto = 'MUNICÍPIO';
1458
        $aFont = $this->formatPadrao;
1459
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1460
        $texto = $this->getTagValue($this->toma, "xMun");
1461
        $aFont = $this->formatNegrito;
1462
        $this->pdf->textBox($x + 15, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1463
        $x = $maxW * 0.85;
1464
        $texto = 'UF';
1465
        $aFont = $this->formatPadrao;
1466
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1467
        $texto = $this->getTagValue($this->toma, "UF");
1468
        $aFont = $this->formatNegrito;
1469
        $this->pdf->textBox($x + 4, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1470
        $x = $w - 18;
1471
        $texto = 'CEP';
1472
        $aFont = $this->formatPadrao;
1473
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1474
        $texto = $this->formatField($this->getTagValue($this->toma, "CEP"), "#####-###");
1475
        $aFont = $this->formatNegrito;
1476
        $this->pdf->textBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1477
        $y += 3;
1478
        $x = $oldX;
1479
        $texto = 'ENDEREÇO';
1480
        $aFont = $this->formatPadrao;
1481
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1482
        $aFont = $this->formatNegrito;
1483
        $texto = $this->getTagValue($this->toma, "xLgr") . ',';
1484
        $texto .= $this->getTagValue($this->toma, "nro");
1485
        $texto .= ($this->getTagValue($this->toma, "xCpl") != "") ?
1486
            ' - ' . $this->getTagValue($this->toma, "xCpl") : '';
1487
        $texto .= ' - ' . $this->getTagValue($this->toma, "xBairro");
1488
        $this->pdf->textBox($x + 16, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1489
        $y += 3;
1490
        $texto = 'CNPJ/CPF';
1491
        $aFont = $this->formatPadrao;
1492
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1493
        $texto = $this->formatCNPJCPF($this->toma);
1494
        $aFont = $this->formatNegrito;
1495
        $this->pdf->textBox($x + 13, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1496
        $x = $x + 65;
1497
        $texto = 'INSCRIÇÃO ESTADUAL';
1498
        $aFont = $this->formatPadrao;
1499
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1500
        $texto = $this->getTagValue($this->toma, "IE");
1501
        $aFont = $this->formatNegrito;
1502
        $this->pdf->textBox($x + 28, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1503
        $x = $w * 0.75;
1504
        $texto = 'PAÍS';
1505
        $aFont = $this->formatPadrao;
1506
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1507
        $texto = $this->getTagValue($this->toma, "xPais") != "" ?
1508
            $this->getTagValue($this->toma, "xPais") : 'BRASIL';
1509
        $aFont = $this->formatNegrito;
1510
        $this->pdf->textBox($x + 6, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1511
        $x = $w - 27;
1512
        $texto = 'FONE';
1513
        $aFont = $this->formatPadrao;
1514
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1515
        $texto = $this->getTagValue($this->toma, "fone") != "" ? $this->formatFone($this->toma) : '';
1516
        $aFont = $this->formatNegrito;
1517
        $this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1518
    }
1519
1520
    /**
1521
     * descricaoCarga
1522
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1523
     *
1524
     * @param number $x Posição horizontal canto esquerdo
1525
     * @param number $y Posição vertical canto superior
1526
     * @return number Posição vertical final
1527
     */
1528
    protected function descricaoCarga($x = 0, $y = 0)
1529
    {
1530
        $oldX = $x;
1531
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
1532
        if ($this->orientacao == 'P') {
1533
            $maxW = $this->wPrint;
1534
        } else {
1535
            $maxW = $this->wPrint - $this->wCanhoto;
1536
        }
1537
        $w = $maxW;
1538
        $h = 17;
1539
        $texto = 'PRODUTO PREDOMINANTE';
1540
        $aFont = array(
1541
            'font' => $this->fontePadrao,
1542
            'size' => 6,
1543
            'style' => '');
1544
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
1545
        $texto = $this->getTagValue($this->infCarga, "proPred");
1546
        $aFont = $this->formatNegrito;
1547
        $this->pdf->textBox($x, $y + 2.8, $w, $h, $texto, $aFont, 'T', 'L', 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...
1548
        $x = $w * 0.56;
1549
        $this->pdf->line($x, $y, $x, $y + 8);
1550
        $aFont = $this->formatPadrao;
1551
        $texto = 'OUTRAS CARACTERÍSTICAS DA CARGA';
1552
        $this->pdf->textBox($x + 1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1553
        $texto = $this->getTagValue($this->infCarga, "xOutCat");
1554
        $aFont = $this->formatNegrito;
1555
        $this->pdf->textBox($x + 1, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
1556
        $x = $w * 0.8;
1557
        $this->pdf->line($x, $y, $x, $y + 8);
1558
        $aFont = $this->formatPadrao;
1559
        $texto = 'VALOR TOTAL DA CARGA';
1560
        $this->pdf->textBox($x + 1, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1561
        $texto = $this->getTagValue($this->infCarga, "vCarga") == "" ?
1562
            $this->getTagValue($this->infCarga, "vMerc") : $this->getTagValue($this->infCarga, "vCarga");
1563
        $texto = number_format($texto, 2, ",", ".");
1564
        $aFont = $this->formatNegrito;
1565
        $this->pdf->textBox($x + 1, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
1566
        $y += 8;
1567
        $x = $oldX;
1568
        $this->pdf->line($x, $y, $w + 1, $y);
1569
        //Identifica código da unidade
1570
        //01 = KG (QUILOS)
1571
        $qCarga = 0;
1572
        foreach ($this->infQ as $infQ) {
1573
            if (in_array($this->getTagValue($infQ, "cUnid"), array('01', '02'))) {
1574
                $qCarga += (float)$this->getTagValue($infQ, "qCarga");
1575
            }
1576
        }
1577
        $texto = 'PESO BRUTO (KG)';
1578
        $aFont = array(
1579
            'font' => $this->fontePadrao,
1580
            'size' => 5,
1581
            'style' => '');
1582
        $this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1583
        $texto = number_format($qCarga, 3, ",", ".");
1584
        $aFont = array(
1585
            'font' => $this->fontePadrao,
1586
            'size' => 7,
1587
            'style' => 'B');
1588
        $this->pdf->textBox($x + 2, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
1589
        $x = $w * 0.12;
1590
        $this->pdf->line($x + 13.5, $y, $x + 13.5, $y + 9);
1591
        $texto = 'PESO BASE CÁLCULO (KG)';
1592
        $aFont = array(
1593
            'font' => $this->fontePadrao,
1594
            'size' => 5,
1595
            'style' => '');
1596
        $this->pdf->textBox($x + 20, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1597
        $texto = number_format($qCarga, 3, ",", ".");
1598
        $aFont = array(
1599
            'font' => $this->fontePadrao,
1600
            'size' => 7,
1601
            'style' => 'B');
1602
        $this->pdf->textBox($x + 17, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
1603
        $x = $w * 0.24;
1604
        $this->pdf->line($x + 25, $y, $x + 25, $y + 9);
1605
        $texto = 'PESO AFERIDO (KG)';
1606
        $aFont = array(
1607
            'font' => $this->fontePadrao,
1608
            'size' => 5,
1609
            'style' => '');
1610
        $this->pdf->textBox($x + 35, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1611
        $texto = number_format($qCarga, 3, ",", ".");
1612
        $aFont = array(
1613
            'font' => $this->fontePadrao,
1614
            'size' => 7,
1615
            'style' => 'B');
1616
        $this->pdf->textBox($x + 28, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
1617
        $x = $w * 0.36;
1618
        $this->pdf->line($x + 41.3, $y, $x + 41.3, $y + 9);
1619
        $texto = 'CUBAGEM(M3)';
1620
        $aFont = $this->formatPadrao;
1621
        $this->pdf->textBox($x + 60, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1622
        $qCarga = 0;
1623
        foreach ($this->infQ as $infQ) {
1624
            if ($this->getTagValue($infQ, "cUnid") == '00') {
1625
                $qCarga += (float)$this->getTagValue($infQ, "qCarga");
1626
            }
1627
        }
1628
        $texto = !empty($qCarga) ? number_format($qCarga, 3, ",", ".") : '';
1629
        $aFont = array(
1630
            'font' => $this->fontePadrao,
1631
            'size' => 7,
1632
            'style' => 'B');
1633
        $this->pdf->textBox($x + 50, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
1634
        $x = $w * 0.45;
1635
        //$this->pdf->line($x+37, $y, $x+37, $y + 9);
1636
        $texto = 'QTDE(VOL)';
1637
        $aFont = $this->formatPadrao;
1638
        $this->pdf->textBox($x + 85, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
1639
        $qCarga = 0;
1640
        foreach ($this->infQ as $infQ) {
1641
            if ($this->getTagValue($infQ, "cUnid") == '03') {
1642
                $qCarga += (float)$this->getTagValue($infQ, "qCarga");
1643
            }
1644
        }
1645
        $texto = !empty($qCarga) ? number_format($qCarga, 3, ",", ".") : '';
1646
        $aFont = array(
1647
            'font' => $this->fontePadrao,
1648
            'size' => 7,
1649
            'style' => 'B');
1650
        $this->pdf->textBox($x + 85, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
1651
        $x = $w * 0.53;
1652
        $this->pdf->line($x + 56, $y, $x + 56, $y + 9);
1653
        /*$texto = 'NOME DA SEGURADORA';
1654
        $aFont = $this->formatPadrao;
1655
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1656
        $texto = $this->getTagValue($this->seg, "xSeg");
1657
        $aFont = array(
1658
            'font' => $this->fontePadrao,
1659
            'size' => 7,
1660
            'style' => 'B');
1661
        $this->pdf->textBox($x + 31, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1662
        $y += 3;
1663
        $this->pdf->line($x, $y, $w + 1, $y);
1664
        $texto = 'RESPONSÁVEL';
1665
        $aFont = $this->formatPadrao;
1666
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1667
        $texto = $this->respSeg;
1668
        $aFont = array(
1669
            'font' => $this->fontePadrao,
1670
            'size' => 7,
1671
            'style' => 'B');
1672
        $this->pdf->textBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1673
        $x = $w * 0.68;
1674
        $this->pdf->line($x, $y, $x, $y + 6);
1675
        $texto = 'NÚMERO DA APOLICE';
1676
        $aFont = $this->formatPadrao;
1677
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1678
        $texto = $this->getTagValue($this->seg, "nApol");
1679
        $aFont = array(
1680
            'font' => $this->fontePadrao,
1681
            'size' => 7,
1682
            'style' => 'B');
1683
        $this->pdf->textBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1684
        $x = $w * 0.85;
1685
        $this->pdf->line($x, $y, $x, $y + 6);
1686
        $texto = 'NÚMERO DA AVERBAÇÃO';
1687
        $aFont = $this->formatPadrao;
1688
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1689
        $texto = $this->getTagValue($this->seg, "nAver");
1690
        $aFont = array(
1691
            'font' => $this->fontePadrao,
1692
            'size' => 7,
1693
            'style' => 'B');
1694
        $this->pdf->textBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 0, '');*/
1695
    }
1696
1697
    /**
1698
     * compValorServ
1699
     * Monta o campo com os componentes da prestação de serviços.
1700
     *
1701
     * @param number $x Posição horizontal canto esquerdo
1702
     * @param number $y Posição vertical canto superior
1703
     * @return number Posição vertical final
1704
     */
1705
    protected function compValorServ($x = 0, $y = 0)
1706
    {
1707
        $oldX = $x;
1708
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
1709
        if ($this->orientacao == 'P') {
1710
            $maxW = $this->wPrint;
1711
        } else {
1712
            $maxW = $this->wPrint - $this->wCanhoto;
1713
        }
1714
        $w = $maxW;
1715
        $h = 25;
1716
        $texto = 'COMPONENTES DO VALOR DA PRESTAÇÃO DO SERVIÇO';
1717
        $aFont = $this->formatPadrao;
1718
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
1719
        $y += 3.4;
1720
        $this->pdf->line($x, $y, $w + 1, $y);
1721
        $texto = 'NOME';
1722
        $aFont = $this->formatPadrao;
1723
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 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...
1724
        $yIniDados = $y;
1725
        $x = $w * 0.14;
1726
        $texto = 'VALOR';
1727
        $aFont = $this->formatPadrao;
1728
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 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...
1729
        $x = $w * 0.28;
1730
        $this->pdf->line($x, $y, $x, $y + 21.5);
1731
        $texto = 'NOME';
1732
        $aFont = $this->formatPadrao;
1733
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 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...
1734
        $x = $w * 0.42;
1735
        $texto = 'VALOR';
1736
        $aFont = $this->formatPadrao;
1737
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 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...
1738
        $x = $w * 0.56;
1739
        $this->pdf->line($x, $y, $x, $y + 21.5);
1740
        $texto = 'NOME';
1741
        $aFont = $this->formatPadrao;
1742
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 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...
1743
        $x = $w * 0.70;
1744
        $texto = 'VALOR';
1745
        $aFont = $this->formatPadrao;
1746
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 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...
1747
        $x = $w * 0.86;
1748
        $this->pdf->line($x, $y, $x, $y + 21.5);
1749
        $y += 1;
1750
        $texto = 'VALOR TOTAL DO SERVIÇO';
1751
        $aFont = $this->formatPadrao;
1752
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', '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...
1753
        $texto = number_format($this->getTagValue($this->vPrest, "vTPrest"), 2, ",", ".");
1754
        $aFont = array(
1755
            'font' => $this->fontePadrao,
1756
            'size' => 9,
1757
            'style' => 'B');
1758
        $this->pdf->textBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', '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...
1759
        $y += 10;
1760
        $this->pdf->line($x, $y, $w + 1, $y);
1761
        $y += 1;
1762
        $texto = 'VALOR A RECEBER';
1763
        $aFont = $this->formatPadrao;
1764
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', '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...
1765
        $texto = number_format($this->getTagValue($this->vPrest, "vRec"), 2, ",", ".");
1766
        $aFont = array(
1767
            'font' => $this->fontePadrao,
1768
            'size' => 9,
1769
            'style' => 'B');
1770
        $this->pdf->textBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', '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...
1771
        $auxX = $oldX;
1772
        $yIniDados += 4;
1773
        foreach ($this->Comp as $k => $d) {
1774
            $nome = $this->Comp->item($k)->getElementsByTagName('xNome')->item(0)->nodeValue;
1775
            $valor = number_format(
1776
                $this->Comp->item($k)->getElementsByTagName('vComp')->item(0)->nodeValue,
1777
                2,
1778
                ",",
1779
                "."
1780
            );
1781
            if ($auxX > $w * 0.60) {
1782
                $yIniDados = $yIniDados + 4;
1783
                $auxX = $oldX;
1784
            }
1785
            $texto = $nome;
1786
            $aFont = $this->formatPadrao;
1787
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 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...
1788
            $auxX += $w * 0.14;
1789
            $texto = $valor;
1790
            $aFont = $this->formatPadrao;
1791
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 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...
1792
            $auxX += $w * 0.14;
1793
        }
1794
    }
1795
1796
    /**
1797
     * impostos
1798
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1799
     *
1800
     * @param number $x Posição horizontal canto esquerdo
1801
     * @param number $y Posição vertical canto superior
1802
     * @return number Posição vertical final
1803
     */
1804
    protected function impostos($x = 0, $y = 0)
1805
    {
1806
        $oldX = $x;
1807
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
1808
        if ($this->orientacao == 'P') {
1809
            $maxW = $this->wPrint;
1810
        } else {
1811
            $maxW = $this->wPrint - $this->wCanhoto;
1812
        }
1813
        $w = $maxW;
1814
        $h = 13;
1815
        $texto = 'INFORMAÇÕES RELATIVAS AO IMPOSTO';
1816
        $aFont = $this->formatPadrao;
1817
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
1818
        $y += 3.4;
1819
        $this->pdf->line($x, $y, $w + 1, $y);
1820
        $texto = 'SITUAÇÃO TRIBUTÁRIA';
1821
        $aFont = $this->formatPadrao;
1822
        $this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 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...
1823
        $x += $w * 0.26;
1824
        $this->pdf->line($x, $y, $x, $y + 9.5);
1825
        $texto = 'BASE DE CALCULO';
1826
        $aFont = $this->formatPadrao;
1827
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 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...
1828
        $wCol02 = 0.15;
1829
        $x += $w * $wCol02;
1830
        $this->pdf->line($x, $y, $x, $y + 9.5);
1831
        $texto = 'ALÍQ ICMS';
1832
        $aFont = $this->formatPadrao;
1833
        $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1834
        $x += $w * $wCol02;
1835
        $this->pdf->line($x, $y, $x, $y + 9.5);
1836
        $texto = 'VALOR ICMS';
1837
        $aFont = $this->formatPadrao;
1838
        $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1839
        $x += $w * $wCol02;
1840
        $this->pdf->line($x, $y, $x, $y + 9.5);
1841
        $texto = '% RED. BC ICMS';
1842
        $aFont = $this->formatPadrao;
1843
        $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1844
        $x += $w * $wCol02;
1845
        $this->pdf->line($x, $y, $x, $y + 9.5);
1846
        $texto = 'VALOR ICMS ST';
1847
        $aFont = $this->formatPadrao;
1848
        $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1849
        /*$x += $w * 0.14;
1850
        $this->pdf->line($x, $y, $x, $y + 9.5);
1851
        $texto = 'ICMS ST';
1852
        $aFont = $this->formatPadrao;
1853
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1854
         * */
1855
        $x = $oldX;
1856
        $y = $y + 4;
1857
        $texto = $this->getTagValue($this->ICMS, "CST");
1858
        switch ($texto) {
1859
            case '00':
1860
                $texto = "00 - Tributação normal ICMS";
1861
                break;
1862
            case '20':
1863
                $texto = "20 - Tributação com BC reduzida do ICMS";
1864
                break;
1865
            case '40':
1866
                $texto = "40 - ICMS isenção";
1867
                break;
1868
            case '41':
1869
                $texto = "41 - ICMS não tributada";
1870
                break;
1871
            case '51':
1872
                $texto = "51 - ICMS diferido";
1873
                break;
1874
            case '60':
1875
                $texto = "60 - ICMS cobrado anteriormente por substituição tributária";
1876
                break;
1877
            case '90':
1878
                if ($this->ICMSOutraUF) {
1879
                    $texto = "90 - ICMS Outra UF";
1880
                } else {
1881
                    $texto = "90 - ICMS Outros";
1882
                }
1883
                break;
1884
        }
1885
        if ($this->getTagValue($this->ICMS, "CST") == '60') {
1886
            $aFont = $this->formatNegrito;
1887
            $this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 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...
1888
            $x += $w * 0.26;
1889
            $texto = !empty($this->ICMS->getElementsByTagName("vBCSTRet")->item(0)->nodeValue) ?
1890
                number_format($this->getTagValue($this->ICMS, "vBCSTRet"), 2, ",", ".") : (
1891
                !empty($this->ICMS->getElementsByTagName("vBCOutraUF")->item(0)->nodeValue) ?
1892
                    number_format($this->getTagValue($this->ICMS, "vBCOutraUF"), 2, ",", ".") : ''
1893
                );
1894
            $aFont = $this->formatNegrito;
1895
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1896
            $x += $w * $wCol02;
1897
            $texto = !empty($this->ICMS->getElementsByTagName("pICMSSTRet")->item(0)->nodeValue) ?
1898
                number_format($this->getTagValue($this->ICMS, "pICMSSTRet"), 2, ",", ".") : (
1899
                !empty($this->ICMS->getElementsByTagName("pICMSOutraUF")->item(0)->nodeValue) ?
1900
                    number_format($this->getTagValue($this->ICMS, "pICMSOutraUF"), 2, ",", ".") : ''
1901
                );
1902
            $aFont = $this->formatNegrito;
1903
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1904
            $x += $w * $wCol02;
1905
            $texto = !empty($this->ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
1906
                number_format($this->getTagValue($this->ICMS, "vICMS"), 2, ",", ".") : (
1907
                !empty($this->ICMS->getElementsByTagName("vICMSOutraUF")->item(0)->nodeValue) ?
1908
                    number_format($this->getTagValue($this->ICMS, "vICMSOutraUF"), 2, ",", ".") : ''
1909
                );
1910
            $aFont = $this->formatNegrito;
1911
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1912
            $x += $w * $wCol02;
1913
            $texto = !empty($this->ICMS->getElementsByTagName("pRedBC")->item(0)->nodeValue) ?
1914
                number_format($this->getTagValue($this->ICMS, "pRedBC"), 2, ",", ".") : (
1915
                !empty($this->ICMS->getElementsByTagName("pRedBCOutraUF")->item(0)->nodeValue) ?
1916
                    number_format($this->getTagValue($this->ICMS, "pRedBCOutraUF"), 2, ",", ".") : ''
1917
                );
1918
            $aFont = $this->formatNegrito;
1919
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1920
            $x += $w * $wCol02;
1921
            $texto = !empty($this->ICMS->getElementsByTagName("vICMSSTRet")->item(0)->nodeValue) ?
1922
                number_format($this->getTagValue($this->ICMS, "vICMSSTRet"), 2, ",", ".") : '';
1923
            $aFont = $this->formatNegrito;
1924
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1925
        } else {
1926
            $texto = $this->getTagValue($this->ICMSSN, "indSN") == 1 ? 'Simples Nacional' : $texto;
1927
            $aFont = $this->formatNegrito;
1928
            $this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 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...
1929
            $x += $w * 0.26;
1930
            $texto = !empty($this->ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
1931
                number_format($this->getTagValue($this->ICMS, "vBC"), 2, ",", ".") : (
1932
                !empty($this->ICMS->getElementsByTagName("vBCOutraUF")->item(0)->nodeValue) ?
1933
                    number_format($this->getTagValue($this->ICMS, "vBCOutraUF"), 2, ",", ".") : ''
1934
                );
1935
            $aFont = $this->formatNegrito;
1936
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1937
            $x += $w * $wCol02;
1938
            $texto = !empty($this->ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
1939
                number_format($this->getTagValue($this->ICMS, "pICMS"), 2, ",", ".") : (
1940
                !empty($this->ICMS->getElementsByTagName("pICMSOutraUF")->item(0)->nodeValue) ?
1941
                    number_format($this->getTagValue($this->ICMS, "pICMSOutraUF"), 2, ",", ".") : ''
1942
                );
1943
            $aFont = $this->formatNegrito;
1944
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1945
            $x += $w * $wCol02;
1946
            $texto = !empty($this->ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
1947
                number_format($this->getTagValue($this->ICMS, "vICMS"), 2, ",", ".") : (
1948
                !empty($this->ICMS->getElementsByTagName("vICMSOutraUF")->item(0)->nodeValue) ?
1949
                    number_format($this->getTagValue($this->ICMS, "vICMSOutraUF"), 2, ",", ".") : ''
1950
                );
1951
            $aFont = $this->formatNegrito;
1952
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1953
            $x += $w * $wCol02;
1954
            $texto = !empty($this->ICMS->getElementsByTagName("pRedBC")->item(0)->nodeValue) ?
1955
                number_format($this->getTagValue($this->ICMS, "pRedBC"), 2, ",", ".") : (
1956
                !empty($this->ICMS->getElementsByTagName("pRedBCOutraUF")->item(0)->nodeValue) ?
1957
                    number_format($this->getTagValue($this->ICMS, "pRedBCOutraUF"), 2, ",", ".") : ''
1958
                );
1959
            $aFont = $this->formatNegrito;
1960
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1961
            $x += $w * $wCol02;
1962
            $texto = !empty($this->ICMS->getElementsByTagName("vICMSSTRet")->item(0)->nodeValue) ?
1963
                number_format($this->getTagValue($this->ICMS, "vICMSSTRet"), 2, ",", ".") : '';
1964
            $aFont = $this->formatNegrito;
1965
            $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 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...
1966
        }
1967
        /*$x += $w * 0.14;
1968
        $texto = '';
1969
        $aFont = $this->formatNegrito;
1970
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');*/
1971
    }
1972
1973
    /**
1974
     * geraChaveAdicCont
1975
     *
1976
     * @return string chave
1977
     */
1978
    protected function geraChaveAdicCont()
1979
    {
1980
        //cUF tpEmis CNPJ vNF ICMSp ICMSs DD  DV
1981
        // Quantidade de caracteres  02   01      14  14    01    01  02 01
1982
        $forma = "%02d%d%s%014d%01d%01d%02d";
1983
        $cUF = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue;
1984
        $CNPJ = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue;
1985
        $CNPJ = substr($CNPJ, -14);
1986
        $vCT = number_format($this->getTagValue($this->vPrest, "vRec"), 2, "", "") * 100;
1987
        $ICMS_CST = $this->getTagValue($this->ICMS, "CST");
1988
        switch ($ICMS_CST) {
1989
            case '00':
1990
            case '20':
1991
                $ICMSp = '1';
1992
                $ICMSs = '2';
1993
                break;
1994
            case '40':
1995
            case '41':
1996
            case '51':
1997
            case '90':
1998
                $ICMSp = '2';
1999
                $ICMSs = '2';
2000
                break;
2001
            case '60':
2002
                $ICMSp = '2';
2003
                $ICMSs = '1';
2004
                break;
2005
        }
2006
        $dd = $this->ide->getElementsByTagName('dhEmi')->item(0)->nodeValue;
2007
        $rpos = strrpos($dd, '-');
2008
        $dd = substr($dd, $rpos + 1);
2009
        $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vCT, $ICMSp, $ICMSs, $dd);
0 ignored issues
show
Bug introduced by
The variable $ICMSp 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...
Bug introduced by
The variable $ICMSs 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...
2010
        $chave = $chave . $this->modulo11($chave);
2011
        return $chave;
2012
    }
2013
2014
    protected function detCont($x = 0, $y = 0)
2015
    {
2016
        $oldX = $x;
2017
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
2018
        if ($this->orientacao == 'P') {
2019
            $maxW = $this->wPrint;
2020
        } else {
2021
            $maxW = $this->wPrint - $this->wCanhoto;
2022
        }
2023
        $w = $maxW;
2024
        $texto = 'INFORMAÇÕES ESPECÍFICAS DO MODAL AQUAVIÁRIO';
2025
        $h = 3.4;
2026
        $aFont = $this->formatPadrao;
2027
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2028
        $y += 3.4;
2029
        $h = 29.6;
2030
        $texto = 'DOCUMENTOS ORIGINÁRIOS';
2031
        $aFont = $this->formatPadrao;
2032
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2033
        $descr1 = 'TIPO DOC';
2034
        $descr2 = 'CNPJ/CPF EMITENTE';
2035
        $descr3 = 'SÉRIE/NRO. DOCUMENTO';
2036
        $descr4 = 'NRO. LACRE';
2037
        $descr5 = 'NRO. CONTEINER';
2038
        $y += 3.4;
2039
        $this->pdf->line($x, $y, $w + 1, $y); // LINHA ABAIXO DO TEXTO: "DOCUMENTOS ORIGINÁRIOS
2040
        $texto = $descr1;
2041
        $aFont = $this->formatPadrao;
2042
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2043
        $yIniDados = $y;
2044
        $x += $w * 0.07;
2045
        $this->pdf->line($x, $y, $x, $y + 26.1);
2046
        $texto = $descr2;
2047
        $aFont = $this->formatPadrao;
2048
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2049
        $x += $w * 0.28;
2050
        $this->pdf->line($x, $y, $x, $y + 26.1);
2051
        $texto = $descr3;
2052
        $aFont = $this->formatPadrao;
2053
        $this->pdf->textBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 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...
2054
        $x += $w * 0.14;
2055
        $this->pdf->line($x, $y, $x, $y + 26.1);
2056
        $texto = $descr4;
2057
        $aFont = $this->formatPadrao;
2058
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2059
        $x += $w * 0.20;
2060
        $this->pdf->line($x, $y, $x, $y + 26.1);
2061
        $texto = $descr5;
2062
        $aFont = $this->formatPadrao;
2063
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2064
        $texto = '';
2065
        $auxX = $oldX;
0 ignored issues
show
Unused Code introduced by
$auxX 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...
2066
        $yIniDados += 3;
2067
        $totalNF = 0;
2068
        $yCont = $y;
2069
        $qtdCont = 0;
2070
        foreach ($this->detCont as $k => $d) {
2071
            $nLacre = '';
2072
            $aFont = array(
2073
                'font' => $this->fontePadrao,
2074
                'size' => 10,
2075
                'style' => '');
2076
            $qtdCont += 1;
2077
            $infNF = $this->detCont->item($k)->getElementsByTagName('infNF');
2078
            $yCont += 3;
2079
            if ($qtdCont < 8) {
2080
                $nCont = $this->detCont->item($k)->getElementsByTagName('nCont')->item(0)->nodeValue;
2081
                $this->pdf->textBox($x, $yCont, $w * 0.23, $h, $nCont, $aFont, 'T', 'L', 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...
2082
            } else {
2083
                $lacres = $this->detCont->item($k)->getElementsByTagName('lacre');
2084
                foreach ($lacres as $lacre) {
2085
                    $nLacre .= $this->getTagValue($lacre, 'nLacre') . '/';
2086
                }
2087
                $texto = substr($nLacre, 0, -1);
2088
                $this->arrayCont[] = [
2089
                    "nCont" => $this->detCont->item($k)->getElementsByTagName('nCont')->item(0)->nodeValue,
2090
                    "nLacre" => $texto
2091
                ];
2092
            }
2093
            if ($qtdCont < 8) {
2094
                $this->pdf->textBox($x - $w * 0.2, $yCont, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2095
            }
2096
            foreach ($infNF as $i => $z) {
2097
                $totalNF += 1;
2098
                if ($totalNF > 7) {
2099
                    $this->arrayNF[] = [
0 ignored issues
show
Bug introduced by
The property arrayNF does not seem to exist. Did you mean arrayNFe?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
2100
                        "serie" => $this->getTagValue($infNF->item($i), 'serie'),
2101
                        "nDoc" => $this->getTagValue($infNF->item($i), 'nDoc')
2102
                    ];
2103
                } else {
2104
                    $tp = 'NF';
2105
                    $cnpj = '-';
2106
                    $doc = $this->getTagValue($infNF->item($i), 'serie');
2107
                    $doc .= '/' . $this->getTagValue($infNF->item($i), 'nDoc');
2108
                    $auxX = $oldX;
2109
                    $texto = $tp;
2110
                    $aFont = array(
2111
                        'font' => $this->fontePadrao,
2112
                        'size' => 8,
2113
                        'style' => '');
2114
                    $this->pdf->textBox($auxX, $yIniDados, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2115
                    //$auxX += $w * 0.09;
2116
                    $auxX += $w * 0.07;
2117
                    $texto = $cnpj;
2118
                    $aFont = array(
2119
                        'font' => $this->fontePadrao,
2120
                        'size' => 8,
2121
                        'style' => '');
2122
                    $this->pdf->textBox($auxX, $yIniDados, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2123
                    $auxX += $w * 0.28;
2124
                    $texto = $doc;
2125
                    $aFont = array(
2126
                        'font' => $this->fontePadrao,
2127
                        'size' => 8,
2128
                        'style' => '');
2129
                    $this->pdf->textBox($auxX, $yIniDados, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 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...
2130
                    $yIniDados = $yIniDados + 3;
2131
                }
2132
            }
2133
            $infNFe = $this->detCont->item($k)->getElementsByTagName('infNFe');
2134
            foreach ($infNFe as $k => $d) {
2135
                $chaveNFe = $infNFe->item($k)->getElementsByTagName('chave')->item(0)->nodeValue;
2136
                $this->arrayNFe[] = $chaveNFe;
2137
            }
2138
        }
2139
        $qtdeNFe = 1;
0 ignored issues
show
Unused Code introduced by
$qtdeNFe 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...
2140
        $qtdDocs = count($this->arrayNFe) + $totalNF;
2141
        if ($qtdDocs > 7) {
2142
            $this->flagDetContContinuacao = 1;
2143
        }
2144
2145
        switch ($qtdDocs) {
2146
            default:
2147
                $this->totPag = 1;
2148
            case ($qtdDocs >= 1044):
2149
                $this->totPag = 11;
2150
                break;
2151
            case ($qtdDocs > 928):
2152
                $this->totPag = 10;
2153
                break;
2154
            case ($qtdDocs > 812):
2155
                $this->totPag = 9;
2156
                break;
2157
            case ($qtdDocs > 696):
2158
                $this->totPag = 8;
2159
                break;
2160
            case ($qtdDocs > 580):
2161
                $this->totPag = 7;
2162
                break;
2163
            case ($qtdDocs > 464):
2164
                $this->totPag = 6;
2165
                break;
2166
            case ($qtdDocs > 348):
2167
                $this->totPag = 5;
2168
                break;
2169
            case ($qtdDocs > 232):
2170
                $this->totPag = 4;
2171
                break;
2172
            case ($qtdDocs > 116):
2173
                $this->totPag = 3;
2174
                break;
2175
            case ($qtdDocs > 12):
2176
                $this->totPag = 2;
2177
                break;
2178
            case ($qtdDocs <= 12):
2179
                $this->totPag = 1;
2180
                break;
2181
        }
2182
        //$r = $this->cabecalho(1, 1, '1', $this->totPag);
2183
        $contador = 0;
2184
        if ($qtdDocs < 7) {
2185
            while ($contador < $qtdDocs - $totalNF) {
2186
                if ($contador == 8) {
2187
                    break;
2188
                }
2189
                $auxX = $oldX;
2190
                $tp = 'NF-e';
2191
                $chaveNFe = $this->arrayNFe[$contador];
2192
                $numNFe = substr($chaveNFe, 25, 9);
2193
                $serieNFe = substr($chaveNFe, 22, 3);
2194
                $doc = $serieNFe . '/' . $numNFe;
2195
                $texto = $tp;
2196
                $aFont = array(
2197
                    'font' => $this->fontePadrao,
2198
                    'size' => 7,
2199
                    'style' => '');
2200
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2201
                $auxX += $w * 0.07;
2202
                $texto = $chaveNFe;
2203
                $aFont = array(
2204
                    'font' => $this->fontePadrao,
2205
                    'size' => 7,
2206
                    'style' => '');
2207
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.27, $h, $texto, $aFont, 'T', 'L', 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...
2208
                $auxX += $w * 0.28;
2209
                $texto = $doc;
2210
                $aFont = array(
2211
                    'font' => $this->fontePadrao,
2212
                    'size' => 7,
2213
                    'style' => '');
2214
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.30, $h, $texto, $aFont, 'T', 'L', 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...
2215
                $auxX += $w * 0.15;
2216
                $contador++;
2217
                $yIniDados = $yIniDados + 3.5;
2218
            }
2219
        } else {
2220
        }
2221
    }
2222
2223
    protected function detContContinuacao($x = 0, $y = 0)
2224
    {
2225
        $x2 = $x;
2226
        $y2 = $y;
2227
        for ($i = 2; $i <= $this->totPag; $i++) {
2228
            $x = $x2;
2229
            $y = $y2;
2230
            $this->pdf->AddPage($this->orientacao, $this->papel);
0 ignored issues
show
Bug introduced by
It seems like $this->papel can also be of type array; however, NFePHP\DA\Legacy\FPDF\Fpdf::addPage() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
2231
            $r = $this->cabecalho(1, 1, $i, $this->totPag);
0 ignored issues
show
Unused Code introduced by
$r 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...
2232
            $oldX = $x;
2233
            $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
2234
            if ($this->orientacao == 'P') {
2235
                $maxW = $this->wPrint;
2236
            } else {
2237
                $maxW = $this->wPrint - $this->wCanhoto;
2238
            }
2239
            $w = $maxW;
2240
            //$h = 6; // de sub-titulo
2241
            //$h = 6 + 3; // de altura do texto (primeira linha
2242
            //$h = 9 + 3.5 ;// segunda linha
2243
            //$h = 9 + 3.5+ 3.5 ;// segunda linha
2244
            $qtdDoc = count($this->arrayNFe) + count($this->arrayNF);
0 ignored issues
show
Bug introduced by
The property arrayNF does not seem to exist. Did you mean arrayNFe?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
2245
            $h = ($qtdDoc * 3.5) + 9;
2246
            if (count($this->arrayNFe) % 2 != 0) {
2247
                $h = $h + 3.5;
2248
            } // Caso tenha apenas 1 registro na ultima linha
2249
            $texto = 'DOCUMENTOS ORIGINÁRIOS - CONTINUACÃO';
2250
            $aFont = $this->formatPadrao;
2251
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2252
            $yCont = $y;
0 ignored issues
show
Unused Code introduced by
$yCont 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...
2253
            $descr1 = 'TIPO DOC';
2254
            $descr2 = 'CNPJ/CPF EMITENTE';
2255
            $descr3 = 'SÉRIE/NRO. DOCUMENTO';
2256
            $descr4 = 'NRO. LACRE';
2257
            $descr5 = 'NRO. CONTEINER';
2258
            $y += 3.4;
2259
            $this->pdf->line($x, $y, $w + 1, $y); // LINHA ABAIXO DO TEXTO: "DOCUMENTOS ORIGINÁRIOS
2260
            $texto = $descr1;
2261
            $aFont = $this->formatPadrao;
2262
2263
            $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2264
            $yIniDados = $y;
2265
            $x += $w * 0.07;
2266
            $this->pdf->line($x, $y, $x, $y + $h - 3.4);
2267
            $texto = $descr2;
2268
            $aFont = $this->formatPadrao;
2269
            $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2270
            $x += $w * 0.28;
2271
            $this->pdf->line($x, $y, $x, $y + $h - 3.4);
2272
            $texto = $descr3;
2273
            $aFont = $this->formatPadrao;
2274
            $this->pdf->textBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 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...
2275
            $x += $w * 0.14;
2276
            $this->pdf->line($x, $y, $x, $y + $h - 3.4);
2277
            $texto = $descr4;
2278
            $aFont = $this->formatPadrao;
2279
            $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2280
            $x += $w * 0.20;
2281
            $this->pdf->line($x, $y, $x, $y + $h - 3.4);
2282
            $texto = $descr5;
2283
            $aFont = $this->formatPadrao;
2284
            $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2285
            $auxX = $oldX;
0 ignored issues
show
Unused Code introduced by
$auxX 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...
2286
            $yIniDados += 3;
2287
            $totalNF = 0;
0 ignored issues
show
Unused Code introduced by
$totalNF 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...
2288
            $yCont = $y + 3;
2289
            $yIniDados = $y + 2;
2290
            foreach ($this->arrayCont as $conteiner) {
2291
                $aFont = $this->formatPadrao;
2292
                $nCont = $conteiner['nCont'];
2293
                $this->pdf->textBox($x, $yCont, $w * 0.23, $h, $nCont, $aFont, 'T', 'L', 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...
2294
                $texto = $conteiner['nLacre'];
2295
                $this->pdf->textBox($x - $w * 0.2, $yCont, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2296
                $yCont += 3;
2297
            }
2298
            foreach ($this->arrayNF as $infNF) {
0 ignored issues
show
Bug introduced by
The property arrayNF does not seem to exist. Did you mean arrayNFe?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
2299
                $tp = 'NF';
2300
                $cnpj = '-';
2301
                $doc = $infNF['serie'];
2302
                $doc .= '/' . $infNF['nDoc'];
2303
                $auxX = $oldX;
2304
                $texto = $tp;
2305
                $aFont = array(
2306
                    'font' => $this->fontePadrao,
2307
                    'size' => 7,
2308
                    'style' => '');
2309
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2310
                $auxX += $w * 0.07;
2311
                $texto = $cnpj;
2312
2313
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2314
                $auxX += $w * 0.28;
2315
                $texto = $doc;
2316
2317
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 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...
2318
                $yIniDados = $yIniDados + 3;
2319
            }
2320
            $contador = 0;
2321
            foreach ($this->arrayNFe as $nfe) {
2322
                $auxX = $oldX;
2323
                $tp = 'NF-e';
2324
                $chaveNFe = $nfe;
2325
                $numNFe = substr($chaveNFe, 25, 9);
2326
                $serieNFe = substr($chaveNFe, 22, 3);
2327
                $doc = $serieNFe . '/' . $numNFe;
2328
                $texto = $tp;
2329
                $aFont = array(
2330
                    'font' => $this->fontePadrao,
2331
                    'size' => 7,
2332
                    'style' => '');
2333
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2334
                $auxX += $w * 0.07;
2335
                $texto = $chaveNFe;
2336
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.27, $h, $texto, $aFont, 'T', 'L', 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...
2337
                $auxX += $w * 0.28;
2338
                $texto = $doc;
2339
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.30, $h, $texto, $aFont, 'T', 'L', 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...
2340
                $yIniDados = $yIniDados + 3;
2341
                $contador++;
2342
            }
2343
        }
2344
    }
2345
2346
    /**
2347
     * docOrig
2348
     * Monta o campo com os documentos originarios.
2349
     *
2350
     * @param number $x Posição horizontal canto esquerdo
2351
     * @param number $y Posição vertical canto superior
2352
     * @return number Posição vertical final
2353
     */
2354
    protected function docOrig($x = 0, $y = 0)
2355
    {
2356
        $oldX = $x;
2357
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
2358
        if ($this->orientacao == 'P') {
2359
            $maxW = $this->wPrint;
2360
        } else {
2361
            $maxW = $this->wPrint - $this->wCanhoto;
2362
        }
2363
        $w = $maxW;
2364
        // SE FOR RODOVIARIO ( BTR-SEMPRE SERÁ )
2365
        if ($this->modal == '1') {
2366
            // 0 - Não; 1 - Sim Será lotação quando houver um único conhecimento de transporte por veículo,
2367
            // ou combinação veicular, e por viagem
2368
            $h = $this->lota == 1 ? 35 : 53;
2369
        } elseif ($this->modal == '2') {
2370
            $h = 53;
2371
        } elseif ($this->modal == '3') {
2372
            $h = 27.6;
2373
        } elseif ($this->modal == '6') {
2374
            $h = 27.6;
2375
        } else {
2376
            $h = 35;
2377
        }
2378
        $texto = 'DOCUMENTOS ORIGINÁRIOS';
2379
        $aFont = $this->formatPadrao;
2380
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2381
        $descr1 = 'TIPO DOC';
2382
        $descr2 = 'CNPJ/CHAVE/OBS';
2383
        $descr3 = 'SÉRIE/NRO. DOCUMENTO';
2384
        $y += 3.4;
2385
        $this->pdf->line($x, $y, $w + 1, $y); // LINHA ABAIXO DO TEXTO: "DOCUMENTOS ORIGINÁRIOS
2386
        $texto = $descr1;
2387
        $aFont = $this->formatPadrao;
2388
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2389
        $yIniDados = $y;
2390
        $x += $w * 0.07;
2391
        $texto = $descr2;
2392
        $aFont = $this->formatPadrao;
2393
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2394
        $x += $w * 0.28;
2395
        $texto = $descr3;
2396
        $aFont = $this->formatPadrao;
2397
        $this->pdf->textBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 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...
2398
        $x += $w * 0.14;
2399
        if ($this->modal == '1') {
2400
            if ($this->lota == 1) {
2401
                $this->pdf->line($x, $y, $x, $y + 31.5); // TESTE
2402
            } else {
2403
                $this->pdf->line($x, $y, $x, $y + 49.5); // TESTE
2404
            }
2405
        } elseif ($this->modal == '2') {
2406
            $this->pdf->line($x, $y, $x, $y + 49.5);
2407
        } elseif ($this->modal == '3') {
2408
            $this->pdf->line($x, $y, $x, $y + 24);
2409
        } elseif ($this->modal == '6') {
2410
            $this->pdf->line($x, $y, $x, $y + 24);
2411
        } else {
2412
            $this->pdf->line($x, $y, $x, $y + 21.5);
2413
        }
2414
        $texto = $descr1;
2415
        $aFont = $this->formatPadrao;
2416
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2417
        $x += $w * 0.08;
2418
        $texto = $descr2;
2419
        $aFont = $this->formatPadrao;
2420
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2421
        $x += $w * 0.28; // COLUNA SÉRIE/NRO.DOCUMENTO DA DIREITA
2422
        $texto = $descr3;
2423
        $aFont = $this->formatPadrao;
2424
        $this->pdf->textBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 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...
2425
        $auxX = $oldX;
2426
        $yIniDados += 3;
2427
        foreach ($this->infNF as $k => $d) {
2428
            $mod = $this->infNF->item($k)->getElementsByTagName('mod');
2429
            $tp = ($mod && $mod->length > 0) ? $mod->item(0)->nodeValue : '';
2430
            $cnpj = $this->formatCNPJCPF($this->rem);
0 ignored issues
show
Documentation introduced by
$this->rem is of type object<DOMNode>, 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...
2431
            $doc = $this->infNF->item($k)->getElementsByTagName('serie')->item(0)->nodeValue;
2432
            $doc .= '/' . $this->infNF->item($k)->getElementsByTagName('nDoc')->item(0)->nodeValue;
2433
            if ($auxX > $w * 0.90) {
2434
                $yIniDados = $yIniDados + 3;
2435
                $auxX = $oldX;
2436
            }
2437
            $texto = $tp;
2438
            $aFont = array(
2439
                'font' => $this->fontePadrao,
2440
                'size' => 8,
2441
                'style' => '');
2442
            //$this->pdf->textBox($auxX, $yIniDados, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 0, '');
2443
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2444
            //$auxX += $w * 0.09;
2445
            $auxX += $w * 0.07;
2446
            $texto = $cnpj;
2447
            $aFont = array(
2448
                'font' => $this->fontePadrao,
2449
                'size' => 8,
2450
                'style' => '');
2451
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2452
            $auxX += $w * 0.28;
2453
            $texto = $doc;
2454
            $aFont = array(
2455
                'font' => $this->fontePadrao,
2456
                'size' => 8,
2457
                'style' => '');
2458
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 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...
2459
            $auxX += $w * 0.15;
2460
        }
2461
        foreach ($this->infNFe as $k => $d) {
2462
            $chaveNFe = $this->infNFe->item($k)->getElementsByTagName('chave')->item(0)->nodeValue;
2463
            $this->arrayNFe[] = $chaveNFe;
2464
        }
2465
        $qtdeNFe = 1;
2466
        if (count($this->arrayNFe) > 15) {
2467
            $this->flagDocOrigContinuacao = 1;
2468
            $qtdeNFe = count($this->arrayNFe);
2469
        }
2470
//        $totPag = count($this->arrayNFe) > 15 ? '2' : '1';
2471
        switch ($qtdeNFe) {
2472
            default:
2473
                $this->totPag = 1;
2474
            case ($qtdeNFe >= 1044):
2475
                $this->totPag = 11;
2476
                break;
2477
            case ($qtdeNFe > 928):
2478
                $this->totPag = 10;
2479
                break;
2480
            case ($qtdeNFe > 812):
2481
                $this->totPag = 9;
2482
                break;
2483
            case ($qtdeNFe > 696):
2484
                $this->totPag = 8;
2485
                break;
2486
            case ($qtdeNFe > 580):
2487
                $this->totPag = 7;
2488
                break;
2489
            case ($qtdeNFe > 464):
2490
                $this->totPag = 6;
2491
                break;
2492
            case ($qtdeNFe > 348):
2493
                $this->totPag = 5;
2494
                break;
2495
            case ($qtdeNFe > 232):
2496
                $this->totPag = 4;
2497
                break;
2498
            case ($qtdeNFe > 116):
2499
                $this->totPag = 3;
2500
                break;
2501
            case ($qtdeNFe > 16):
2502
                $this->totPag = 2;
2503
                break;
2504
            case ($qtdeNFe <= 16):
2505
                $this->totPag = 1;
2506
                break;
2507
        }
2508
        //$r = $this->cabecalho(1, 1, '1', $this->totPag);
2509
        $contador = 0;
2510
        while ($contador < count($this->arrayNFe)) {
2511
            if ($contador == 16) {
2512
                break;
2513
            }
2514
            $tp = 'NF-e';
2515
            $chaveNFe = $this->arrayNFe[$contador];
2516
            $numNFe = substr($chaveNFe, 25, 9);
2517
            $serieNFe = substr($chaveNFe, 22, 3);
2518
            $doc = $serieNFe . '/' . $numNFe;
2519
            if ($auxX > $w * 0.90) {
2520
                $yIniDados = $yIniDados + 3.5;
2521
                $auxX = $oldX;
2522
            }
2523
            $texto = $tp;
2524
            $aFont = array(
2525
                'font' => $this->fontePadrao,
2526
                'size' => 7,
2527
                'style' => '');
2528
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2529
            $auxX += $w * 0.07;
2530
            $texto = $chaveNFe;
2531
            $aFont = array(
2532
                'font' => $this->fontePadrao,
2533
                'size' => 7,
2534
                'style' => '');
2535
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.27, $h, $texto, $aFont, 'T', 'L', 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...
2536
            $auxX += $w * 0.28;
2537
            $texto = $doc;
2538
            $aFont = array(
2539
                'font' => $this->fontePadrao,
2540
                'size' => 7,
2541
                'style' => '');
2542
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.30, $h, $texto, $aFont, 'T', 'L', 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...
2543
            $auxX += $w * 0.15;
2544
            $contador++;
2545
        }
2546
        foreach ($this->infOutros as $k => $d) {
2547
            $temp = $this->infOutros->item($k);
2548
            $tpDoc = $this->getTagValue($temp, "tpDoc");
2549
            $descOutros = $this->getTagValue($temp, "descOutros");
2550
            $nDoc = $this->getTagValue($temp, "nDoc");
2551
            $dEmi = $this->getTagValue($temp, "dEmi");
2552
            if (!empty($dEmi)) {
2553
                $dEmi = "Emissão: " . date('d/m/Y', strtotime($this->getTagValue($temp, "dEmi")));
2554
            }
2555
            $vDocFisc = $this->getTagValue($temp, "vDocFisc", "Valor: ");
2556
            $dPrev = $this->getTagValue($temp, "dPrev");
2557
            $dPrev = !empty($dPrev) ? ("Entrega: " . date('d/m/Y', strtotime($this->getTagValue($temp, "dPrev")))) : '';
2558
            switch ($tpDoc) {
2559
                case "00":
2560
                    $tpDoc = "00 - Declaração";
2561
                    break;
2562
                case "10":
2563
                    $tpDoc = "10 - Dutoviário";
2564
                    break;
2565
                case "99":
2566
                    $tpDoc = "99 - Outros: [" . $descOutros . "]";
2567
                    break;
2568
                default:
2569
                    break;
2570
            }
2571
            $numeroDocumento = $nDoc;
0 ignored issues
show
Unused Code introduced by
$numeroDocumento 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...
2572
            $cnpjChave = $dEmi . " " . $vDocFisc . " " . $dPrev;
2573
            if ($auxX > $w * 0.90) {
2574
                $yIniDados = $yIniDados + 4;
2575
                $auxX = $oldX;
2576
            }
2577
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.10, $h, $tpDoc, $aFont, 'T', 'L', 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...
2578
            $auxX += $w * 0.09;
2579
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.27, $h, $cnpjChave, $aFont, 'T', 'L', 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...
2580
            $auxX += $w * 0.28;
2581
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.30, $h, $nDoc, $aFont, 'T', 'L', 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...
2582
            $auxX += $w * 0.14;
2583
        }
2584
        foreach ($this->idDocAntEle as $k => $d) {
2585
            $tp = 'CT-e';
2586
            $chaveCTe = $this->idDocAntEle->item($k)->getElementsByTagName('chCTe')->item(0)->nodeValue;
0 ignored issues
show
Bug introduced by
The method item cannot be called on $this->idDocAntEle (of type array).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
2587
            $numCTe = substr($chaveCTe, 25, 9);
2588
            $serieCTe = substr($chaveCTe, 22, 3);
2589
            $doc = $serieCTe . '/' . $numCTe;
2590
            if ($auxX > $w * 0.90) {
2591
                $yIniDados = $yIniDados + 4;
2592
                $auxX = $oldX;
2593
            }
2594
            $texto = $tp;
2595
            $aFont = array(
2596
                'font' => $this->fontePadrao,
2597
                'size' => 8,
2598
                'style' => '');
2599
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2600
            $auxX += $w * 0.09;
2601
            $texto = $chaveCTe;
2602
            $aFont = array(
2603
                'font' => $this->fontePadrao,
2604
                'size' => 8,
2605
                'style' => '');
2606
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.27, $h, $texto, $aFont, 'T', 'L', 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...
2607
            $auxX += $w * 0.28;
2608
            $texto = $doc;
2609
            $aFont = array(
2610
                'font' => $this->fontePadrao,
2611
                'size' => 8,
2612
                'style' => '');
2613
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.30, $h, $texto, $aFont, 'T', 'L', 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...
2614
            $auxX += $w * 0.14;
2615
        }
2616
        foreach ($this->infCTeMultimodal as $k => $d) {
2617
            $tp = 'CT-e';
2618
            $chaveCTe = $this->infCTeMultimodal->item($k)->getElementsByTagName('chCTeMultimodal')->item(0)->nodeValue;
0 ignored issues
show
Bug introduced by
The method item cannot be called on $this->infCTeMultimodal (of type array).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
2619
            $numCTe = substr($chaveCTe, 25, 9);
2620
            $serieCTe = substr($chaveCTe, 22, 3);
2621
            $doc = $serieCTe . '/' . $numCTe;
2622
            if ($auxX > $w * 0.90) {
2623
                $yIniDados = $yIniDados + 4;
2624
                $auxX = $oldX;
2625
            }
2626
            $texto = $tp;
2627
            $aFont = array(
2628
                'font' => $this->fontePadrao,
2629
                'size' => 8,
2630
                'style' => '');
2631
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2632
            $auxX += $w * 0.09;
2633
            $texto = $chaveCTe;
2634
            $aFont = array(
2635
                'font' => $this->fontePadrao,
2636
                'size' => 8,
2637
                'style' => '');
2638
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.27, $h, $texto, $aFont, 'T', 'L', 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...
2639
            $auxX += $w * 0.28;
2640
            $texto = $doc;
2641
            $aFont = array(
2642
                'font' => $this->fontePadrao,
2643
                'size' => 8,
2644
                'style' => '');
2645
            $this->pdf->textBox($auxX, $yIniDados, $w * 0.30, $h, $texto, $aFont, 'T', 'L', 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...
2646
            $auxX += $w * 0.14;
2647
        }
2648
    }
2649
2650
    /**
2651
     * docOrigContinuacao
2652
     * Monta o campo com os documentos originarios.
2653
     *
2654
     * @param number $x Posição horizontal canto esquerdo
2655
     * @param number $y Posição vertical canto superior
2656
     * @return number Posição vertical final
2657
     */
2658
    protected function docOrigContinuacao($x = 0, $y = 0)
2659
    {
2660
        $x2 = $x;
2661
        $y2 = $y;
2662
        $contador = 16;
2663
        for ($i = 2; $i <= $this->totPag; $i++) {
2664
            $x = $x2;
2665
            $y = $y2;
2666
            $this->pdf->AddPage($this->orientacao, $this->papel);
0 ignored issues
show
Bug introduced by
It seems like $this->papel can also be of type array; however, NFePHP\DA\Legacy\FPDF\Fpdf::addPage() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
2667
            $r = $this->cabecalho(1, 1, $i, $this->totPag);
0 ignored issues
show
Unused Code introduced by
$r 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...
2668
            $oldX = $x;
2669
            $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
2670
            if ($this->orientacao == 'P') {
2671
                $maxW = $this->wPrint;
2672
            } else {
2673
                $maxW = $this->wPrint - $this->wCanhoto;
2674
            }
2675
            $w = $maxW;
2676
            //$h = 6; // de sub-titulo
2677
            //$h = 6 + 3; // de altura do texto (primeira linha
2678
            //$h = 9 + 3.5 ;// segunda linha
2679
            //$h = 9 + 3.5+ 3.5 ;// segunda linha
2680
            $h = (((count($this->arrayNFe) / 2) - 9) * 3.5) + 9;
2681
            if (count($this->arrayNFe) % 2 != 0) {
2682
                $h = $h + 3.5;
2683
            } // Caso tenha apenas 1 registro na ultima linha
2684
            $texto = 'DOCUMENTOS ORIGINÁRIOS - CONTINUACÃO';
2685
            $aFont = $this->formatPadrao;
2686
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2687
            $descr1 = 'TIPO DOC';
2688
            $descr2 = 'CNPJ/CHAVE/OBS';
2689
            $descr3 = 'SÉRIE/NRO. DOCUMENTO';
2690
            $y += 3.4;
2691
            $this->pdf->line($x, $y, $w + 1, $y);
2692
            $texto = $descr1;
2693
            $aFont = $this->formatPadrao;
2694
            $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2695
            $yIniDados = $y;
2696
            $x += $w * 0.07; // COLUNA CNPJ/CHAVE/OBS
2697
            $texto = $descr2;
2698
            $aFont = $this->formatPadrao;
2699
            $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2700
            $x += $w * 0.28;
2701
            $texto = $descr3;
2702
            $aFont = $this->formatPadrao;
2703
            $this->pdf->textBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 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...
2704
            $x += $w * 0.14;
2705
            if ($this->modal == '1') {
2706
                if ($this->lota == 1) {
2707
                    $this->pdf->line($x, $y, $x, $y + 31.5);
2708
                } else {
2709
                    $this->pdf->line($x, $y, $x, $y + 49.5);
2710
                }
2711
            } elseif ($this->modal == '2') {
2712
                $this->pdf->line($x, $y, $x, $y + 49.5);
2713
            } elseif ($this->modal == '3') {
2714
                $this->pdf->line($x, $y, $x, $y + 34.1);
2715
            } elseif ($this->modal == '6') {
2716
                $this->pdf->line($x, $y, $x, $y + 34.1);
2717
            } else {
2718
                $this->pdf->line($x, $y, $x, $y + 21.5);
2719
            }
2720
            $texto = $descr1;
2721
            $aFont = $this->formatPadrao;
2722
            $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2723
            $x += $w * 0.08;
2724
            $texto = $descr2;
2725
            $aFont = $this->formatPadrao;
2726
            $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2727
            $x += $w * 0.28; // COLUNA SÉRIE/NRO.DOCUMENTO DA DIREITA
2728
            $texto = $descr3;
2729
            $aFont = $this->formatPadrao;
2730
            $this->pdf->textBox($x, $y, $w * 0.13, $h, $texto, $aFont, 'T', 'L', 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...
2731
            $auxX = $oldX;
2732
            $yIniDados += 3;
2733
            while ($contador < (count($this->arrayNFe))) {
2734
                if ($contador % (116 * ($i - 1)) == 0) {
2735
//                    $contador++;
2736
                    break;
2737
                }
2738
                $tp = 'NF-e';
2739
                $chaveNFe = $this->arrayNFe[$contador];
2740
                $numNFe = substr($chaveNFe, 25, 9);
2741
                $serieNFe = substr($chaveNFe, 22, 3);
2742
                $doc = $serieNFe . '/' . $numNFe;
2743
                if ($auxX > $w * 0.90) {
2744
                    $yIniDados = $yIniDados + 3.5;
2745
                    $auxX = $oldX;
2746
                }
2747
                $texto = $tp;
2748
                $aFont = array(
2749
                    'font' => $this->fontePadrao,
2750
                    'size' => 7,
2751
                    'style' => '');
2752
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
2753
                $auxX += $w * 0.07;
2754
                $texto = $chaveNFe;
2755
                $aFont = array(
2756
                    'font' => $this->fontePadrao,
2757
                    'size' => 7,
2758
                    'style' => '');
2759
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.27, $h, $texto, $aFont, 'T', 'L', 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...
2760
                $auxX += $w * 0.28;
2761
                $texto = $doc;
2762
                $aFont = array(
2763
                    'font' => $this->fontePadrao,
2764
                    'size' => 7,
2765
                    'style' => '');
2766
                $this->pdf->textBox($auxX, $yIniDados, $w * 0.30, $h, $texto, $aFont, 'T', 'L', 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...
2767
                $auxX += $w * 0.15;
2768
                $contador++;
2769
            }
2770
        }
2771
    }
2772
2773
    /**
2774
     * docCompl
2775
     * Monta o campo com os dados do remetente na DACTE.
2776
     *
2777
     * @param number $x Posição horizontal canto esquerdo
2778
     * @param number $y Posição vertical canto superior
2779
     * @return number Posição vertical final
2780
     */
2781
    protected function docCompl($x = 0, $y = 0)
2782
    {
2783
        $oldX = $x;
2784
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
2785
        if ($this->orientacao == 'P') {
2786
            $maxW = $this->wPrint;
2787
        } else {
2788
            $maxW = $this->wPrint - $this->wCanhoto;
2789
        }
2790
        $w = $maxW;
2791
        $h = 80;
2792
        if ($this->tpCTe == 1) {
2793
            $texto = 'DETALHAMENTO DO CT-E COMPLEMENTADO';
2794
            $descr1 = 'CHAVE DO CT-E COMPLEMENTADO';
2795
            $descr2 = 'VALOR COMPLEMENTADO';
2796
        } else {
2797
            $texto = 'DETALHAMENTO DO CT-E ANULADO';
2798
            $descr1 = 'CHAVE DO CT-E ANULADO';
2799
            $descr2 = 'VALOR ANULADO';
2800
        }
2801
        $aFont = $this->formatPadrao;
2802
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2803
        $y += 3.4;
2804
        $this->pdf->line($x, $y, $w + 1, $y);
2805
        $texto = $descr1;
2806
        $aFont = $this->formatPadrao;
2807
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
2808
        $yIniDados = $y;
2809
        $x += $w * 0.37;
2810
        $texto = $descr2;
2811
        $aFont = $this->formatPadrao;
2812
        $this->pdf->textBox($x - 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
2813
        $x += $w * 0.13;
2814
        $this->pdf->line($x, $y, $x, $y + 76.5);
2815
        $texto = $descr1;
2816
        $aFont = $this->formatPadrao;
2817
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
2818
        $x += $w * 0.3;
2819
        $texto = $descr2;
2820
        $aFont = $this->formatPadrao;
2821
        $this->pdf->textBox($x + 8, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
2822
        $auxX = $oldX;
2823
        $yIniDados += 4;
2824
        if ($auxX > $w * 0.90) {
2825
            $yIniDados = $yIniDados + 4;
2826
            $auxX = $oldX;
2827
        }
2828
        $texto = $this->chaveCTeRef;
2829
        $aFont = array(
2830
            'font' => $this->fontePadrao,
2831
            'size' => 8,
2832
            'style' => '');
2833
        $this->pdf->textBox($auxX, $yIniDados, $w, $h, $texto, $aFont, 'T', 'L', 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...
2834
        $texto = number_format($this->getTagValue($this->vPrest, "vTPrest"), 2, ",", ".");
2835
        $aFont = array(
2836
            'font' => $this->fontePadrao,
2837
            'size' => 8,
2838
            'style' => '');
2839
        $this->pdf->textBox($w * 0.40, $yIniDados, $w, $h, $texto, $aFont, 'T', 'L', 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...
2840
    }
2841
2842
    /**
2843
     * observacao
2844
     * Monta o campo com os dados do remetente na DACTE.
2845
     *
2846
     * @param number $x Posição horizontal canto esquerdo
2847
     * @param number $y Posição vertical canto superior
2848
     * @return number Posição vertical final
2849
     */
2850
    protected function observacao($x = 0, $y = 0)
2851
    {
2852
        $oldX = $x;
2853
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
2854
        if ($this->orientacao == 'P') {
2855
            $maxW = $this->wPrint;
2856
        } else {
2857
            $maxW = $this->wPrint - $this->wCanhoto;
2858
        }
2859
        $w = $maxW;
2860
        //$h = 18;
2861
        $h = 18.8;
2862
        $texto = 'OBSERVAÇÕES GERAIS';
2863
        $aFont = $this->formatPadrao;
2864
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2865
        $y += 3.4;
2866
        $this->pdf->line($x, $y, $w + 1, $y);
2867
        $auxX = $oldX;
0 ignored issues
show
Unused Code introduced by
$auxX 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...
2868
        $yIniDados = $y;
0 ignored issues
show
Unused Code introduced by
$yIniDados 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...
2869
        $texto = '';
2870
        foreach ($this->compl as $k => $d) {
2871
            $xObs = $this->getTagValue($this->compl->item($k), "xObs");
2872
            $texto .= $xObs;
2873
        }
2874
        $textoObs = explode("Motorista:", $texto);
2875
        $textoObs[1] = isset($textoObs[1]) ? "Motorista: " . $textoObs[1] : '';
2876
        $texto .= $this->getTagValue($this->imp, "infAdFisco", "\r\n");
2877
        $aFont = array(
2878
            'font' => $this->fontePadrao,
2879
            'size' => 7.5,
2880
            'style' => '');
2881
        $this->pdf->textBox($x, $y, $w, $h, $textoObs[0], $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...
2882
        $this->pdf->textBox($x, $y + 11.5, $w, $h, $textoObs[1], $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...
2883
    }
2884
2885
    /**
2886
     * modalRod
2887
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
2888
     *
2889
     * @param number $x Posição horizontal canto esquerdo
2890
     * @param number $y Posição vertical canto superior
2891
     * @return number Posição vertical final
2892
     */
2893
    protected function modalRod($x = 0, $y = 0)
2894
    {
2895
        $oldX = $x;
0 ignored issues
show
Unused Code introduced by
$oldX 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...
2896
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
2897
        $lotacao = '';
0 ignored issues
show
Unused Code introduced by
$lotacao 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...
2898
        if ($this->orientacao == 'P') {
2899
            $maxW = $this->wPrint;
2900
        } else {
2901
            $maxW = $this->wPrint - $this->wCanhoto;
2902
        }
2903
        $w = $maxW;
2904
        $h = 3;
2905
        $texto = 'DADOS ESPECÍFICOS DO MODAL RODOVIÁRIO';
2906
        $aFont = $this->formatPadrao;
2907
        $this->pdf->textBox($x, $y, $w, $h * 3.2, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2908
        if ($this->lota == 1) {
2909
            $this->pdf->line($x, $y + 12, $w + 1, $y + 12); // LINHA DE BAIXO
2910
        }
2911
        $y += 3.4;
2912
        $this->pdf->line($x, $y, $w + 1, $y); // LINHA DE CIMA
2913
        $texto = 'RNTRC DA EMPRESA';
2914
        $aFont = $this->formatPadrao;
2915
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2916
        $texto = $this->getTagValue($this->rodo, "RNTRC");
2917
        $aFont = $this->formatNegrito;
2918
        $this->pdf->textBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2919
        $x += $w * 0.23;
2920
        $this->pdf->line($x - 20, $y, $x - 20, $y + 6); // LINHA A FRENTE DA RNTRC DA EMPRESA
2921
        $texto = 'ESTE CONHECIMENTO DE TRANSPORTE ATENDE À LEGISLAÇÃO DE TRANSPORTE RODOVIÁRIO EM VIGOR';
2922
        $aFont = $this->formatPadrao;
2923
        $this->pdf->textBox($x - 20, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', '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...
2924
    }
2925
2926
    /**
2927
     * modalAereo
2928
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
2929
     *
2930
     * @param number $x Posição horizontal canto esquerdo
2931
     * @param number $y Posição vertical canto superior
2932
     * @return number Posição vertical final
2933
     */
2934
    protected function modalAereo($x = 0, $y = 0)
2935
    {
2936
        $oldX = $x;
0 ignored issues
show
Unused Code introduced by
$oldX 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...
2937
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
2938
        $lotacao = '';
0 ignored issues
show
Unused Code introduced by
$lotacao 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...
2939
        if ($this->orientacao == 'P') {
2940
            $maxW = $this->wPrint;
2941
        } else {
2942
            $maxW = $this->wPrint - $this->wCanhoto;
2943
        }
2944
        $w = $maxW;
2945
        $h = 3;
2946
        $texto = 'DADOS ESPECÍFICOS DO MODAL AÉREO';
2947
        $aFont = $this->formatPadrao;
2948
        $this->pdf->textBox($x, $y, $w, $h * 3.2, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2949
        $y += 3.4;
2950
        $this->pdf->line($x, $y, $w + 1, $y); // LINHA DE CIMA
2951
        $texto = 'NÚMERO OPERACIONAL DO CONHECIMENTO AÉREO';
2952
        $aFont = $this->formatPadrao;
2953
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2954
        $texto = 'CLASSE DA TARIFA';
2955
        $aFont = $this->formatPadrao;
2956
        $this->pdf->textBox($x + 50, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2957
        $texto = 'CÓDIGO DA TARIFA';
2958
        $aFont = $this->formatPadrao;
2959
        $this->pdf->textBox($x + 80, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2960
        $texto = 'VALOR DA TARIFA';
2961
        $aFont = $this->formatPadrao;
2962
        $this->pdf->textBox($x + 110, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2963
        $texto = $this->getTagValue($this->aereo, "nOCA");
2964
        $aFont = $this->formatNegrito;
2965
        $this->pdf->textBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2966
        $x += $w * 0.23;
2967
        $this->pdf->line($x, $y, $x, $y + 6); // LINHA APÓS NÚMERO OP. DO CT-E AEREO
2968
        $texto = $this->getTagValue($this->aereo, "CL");
2969
        $aFont = $this->formatNegrito;
2970
        $this->pdf->textBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2971
        $x += 30;
2972
        $this->pdf->line($x, $y, $x, $y + 6); // LINHA APÓS CLASSE DA TARIFA
2973
        $texto = $this->getTagValue($this->aereo, "cTar");
2974
        $aFont = $this->formatNegrito;
2975
        $this->pdf->textBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2976
        $x += 30;
2977
        $this->pdf->line($x, $y, $x, $y + 6); // LINHA APÓS COD DA TARIFA
2978
        $texto = $this->getTagValue($this->aereo, "vTar");
2979
        $aFont = $this->formatNegrito;
2980
        $this->pdf->textBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
2981
    }
2982
2983
    protected function modalMultimodal($x = 0, $y = 0)
2984
    {
2985
        $oldX = $x;
2986
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
2987
        if ($this->orientacao == 'P') {
2988
            $maxW = $this->wPrint;
2989
        } else {
2990
            $maxW = $this->wPrint - $this->wCanhoto;
2991
        }
2992
        $w = $maxW;
2993
        $h = 8.5;
2994
2995
        $texto = 'PREVISÃO DO FLUXO DE CARGA';
2996
        $aFont = $this->formatPadrao;
2997
        $x = $oldX;
2998
        $this->pdf->textBox($x, $y, $w, $h * 1.2, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
2999
        $y += 3.4;
3000
        $this->pdf->line($x, $y, $x + $w, $y);
3001
        $texto = 'SIGLA OU CÓDIGO INT. DA FILIAL/PORTO/ESTAÇÃO/AEROPORTO DE ORIGEM';
3002
        $this->pdf->textBox($x, $y, $w * 0.33, $h * 1.2, $texto, $aFont, 'T', '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...
3003
        $fluxo = $this->dom->getElementsByTagName("fluxo")->item(0);
3004
        $texto = $this->getTagValue($fluxo, 'xOrig');
3005
        $this->pdf->textBox($x, $y + 3.5, $w * 0.33, $h * 1.2, $texto, $aFont, 'T', '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...
3006
        $x += $w * 0.33;
3007
        $this->pdf->line($x, $y + 6.5, $x, $y);
3008
        $texto = 'SIGLA OU CÓDIGO INT. DA FILIAL/PORTO/ESTAÇÃO/AEROPORTO DE PASSAGEM';
3009
        $this->pdf->textBox($x, $y, $w * 0.33, $h * 1.2, $texto, $aFont, 'T', '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...
3010
        $pass = $this->dom->getElementsByTagName("pass");
3011
        $texto = '';
3012
        if (isset($pass)) {
3013
            foreach ($pass as $passagem) {
3014
                $texto .= $this->getTagValue($passagem, 'xPass');
3015
            }
3016
        }
3017
        $this->pdf->textBox($x, $y + 3.5, $w * 0.33, $h * 1.2, $texto, $aFont, 'T', '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...
3018
        $x += $w * 0.33;
3019
        $this->pdf->line($x, $y + 6.5, $x, $y);
3020
        $texto = 'SIGLA OU CÓDIGO INT. DA FILIAL/PORTO/ESTAÇÃO/AEROPORTO DE DESTINO';
3021
        $this->pdf->textBox($x, $y, $w * 0.33, $h * 1.3, $texto, $aFont, 'T', '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...
3022
        $texto = $this->getTagValue($fluxo, 'xDest');
3023
        $this->pdf->textBox($x, $y + 3.5, $w * 0.33, $h * 1.3, $texto, $aFont, 'T', '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...
3024
        $x = $oldX;
3025
        $y += 6.8;
3026
        $this->observacao($x, $y);
3027
        $y += $h * 2.2;
3028
        $h += 3;
3029
        $x = 1;
3030
        $aFont = $this->formatPadrao;
3031
        $texto = '';
3032
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3033
        $texto = 'INFORMAÇÕES E ESPECIFICAÇÕES DO TRANSPORTE MULTIMODAL DE CARGAS';
3034
        $this->pdf->textBox($x, $y, $w, 2, $texto, $aFont, 'T', '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...
3035
        $y += 3;
3036
        $this->pdf->line($x, $y, $x + $w, $y);
3037
        $texto = 'Nº DO CERTIFICADO DO OPERADOR DE TRANSPORTE MULTIMODAL';
3038
        $aFont = $this->formatPadrao;
3039
        $this->pdf->textBox($x, $y, $w * 0.7, $h, $texto, $aFont, 'T', 'L', 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...
3040
        $multimodal = $this->dom->getElementsByTagName("multimodal")->item(0);
3041
        $texto = $this->getTagValue($multimodal, 'COTM');
3042
        $aFont = $this->formatNegrito;
3043
        $this->pdf->textBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 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...
3044
        $x += $w * 0.7;
3045
        $this->pdf->line($x, $y, $x, $y + 8.5);
3046
        $texto = 'INDICADOR NEGOCIÁVEL';
3047
        $indNegociavel = $this->getTagValue($multimodal, 'indNegociavel');
3048
        if ($indNegociavel == 1) {
3049
            $aFont = array(
3050
                'font' => $this->fontePadrao,
3051
                'size' => 11,
3052
                'style' => '');
3053
            $this->pdf->textBox($x - ($w * 0.22), $y + 2.5, $w * 0.5, $h, 'X', $aFont, 'T', '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...
3054
        } else {
3055
            $aFont = array(
3056
                'font' => $this->fontePadrao,
3057
                'size' => 11,
3058
                'style' => '');
3059
            $this->pdf->textBox($x - ($w * 0.09), $y + 2.5, $w * 0.5, $h, 'X', $aFont, 'T', '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...
3060
        }
3061
3062
        $aFont = $this->formatPadrao;
3063
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
3064
3065
        $this->pdf->line($x + 3, $y + 3, $x + 3, $y + 7);
3066
        $this->pdf->line($x + 8, $y + 3, $x + 8, $y + 7);
3067
        $this->pdf->line($x + 3, $y + 3, $x + 8, $y + 3);
3068
        $this->pdf->line($x + 3, $y + 7, $x + 8, $y + 7);
3069
3070
        $texto = 'NEGOCIÁVEL';
3071
        $aFont = $this->formatNegrito;
3072
        $this->pdf->textBox($x + ($w * 0.04), $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 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...
3073
        $x += $w * 0.15;
3074
3075
        $this->pdf->line($x, $y + 3, $x, $y + 7);
3076
        $this->pdf->line($x + 5, $y + 3, $x + 5, $y + 7);
3077
        $this->pdf->line($x, $y + 3, $x + 5, $y + 3);
3078
        $this->pdf->line($x, $y + 7, $x + 5, $y + 7);
3079
3080
        $texto = 'NÃO NEGOCIÁVEL';
3081
        $aFont = $this->formatNegrito;
3082
        $this->pdf->textBox($x + ($w * 0.03), $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 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...
3083
        $x += 6;
3084
        $x = $oldX;
3085
        $y += $h - 1.5;
3086
        $texto = 'INFORMAÇÕES DO SEGURO DO MULTIMODAL';
3087
        $aFont = $this->formatPadrao;
3088
        $this->pdf->textBox($x, $y, $w, $h * 1.2, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3089
        $this->pdf->line($oldX, $y + 3.5, $oldX + $w, $y + 3.5);
3090
        $this->pdf->line($x + ($w * 0.25), $y + 3.5, $x + ($w * 0.25), $y + 13.5);
3091
        $this->pdf->line($x + ($w * 0.50), $y + 3.5, $x + ($w * 0.50), $y + 13.5);
3092
        $this->pdf->line($x + ($w * 0.75), $y + 3.5, $x + ($w * 0.75), $y + 13.5);
3093
        $texto = 'CNPJ DA SEGURADORA';
3094
        $aFont = $this->formatPadrao;
3095
        $this->pdf->textBox($oldX, $y + 3.5, $w * 0.33, $h, $texto, $aFont, 'T', 'L', 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...
3096
        $segMultimodal = $multimodal->getElementsByTagName("seg")->item(0);
3097
        $cnpjSeg = $this->getTagValue($segMultimodal, 'CNPJ');
3098
        $texto = $cnpjSeg;
3099
        $aFont = $this->formatNegrito;
3100
        $this->pdf->textBox($oldX, $y + 7, $w * 0.33, $h, $texto, $aFont, 'T', 'L', 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...
3101
        $texto = 'NOME DA SEGURADORA';
3102
        $aFont = $this->formatPadrao;
3103
        $this->pdf->textBox($oldX + ($w * 0.25), $y + 3.5, $w * 0.25, $h, $texto, $aFont, 'T', 'L', 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...
3104
        $texto = $this->getTagValue($segMultimodal, 'xSeg');
3105
        $aFont = $this->formatNegrito;
3106
        $this->pdf->textBox($oldX + ($w * 0.25), $y + 7, $w * 0.25, $h, $texto, $aFont, 'T', 'L', 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...
3107
        $texto = 'NÚMERO DA APÓLICE';
3108
        $aFont = $this->formatPadrao;
3109
        $this->pdf->textBox($oldX + ($w * 0.50), $y + 3.5, $w * 0.25, $h, $texto, $aFont, 'T', 'L', 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...
3110
        $texto = $this->getTagValue($multimodal, 'nApol');
3111
        $aFont = $this->formatNegrito;
3112
        $this->pdf->textBox($oldX + ($w * 0.50), $y + 7, $w * 0.25, $h, $texto, $aFont, 'T', 'L', 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...
3113
        $texto = 'NÚMERO DA AVERBAÇÃO';
3114
        $aFont = $this->formatPadrao;
3115
        $this->pdf->textBox($oldX + ($w * 0.75), $y + 3.5, $w * 0.25, $h, $texto, $aFont, 'T', 'L', 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...
3116
        $texto = $this->getTagValue($multimodal, 'nAver');
3117
        $aFont = $this->formatNegrito;
3118
        $this->pdf->textBox($oldX + ($w * 0.75), $y + 7, $w * 0.25, $h, $texto, $aFont, 'T', 'L', 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...
3119
    }
3120
3121
3122
    /**
3123
     * modalAquaviario
3124
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
3125
     *
3126
     * @param number $x Posição horizontal canto esquerdo
3127
     * @param number $y Posição vertical canto superior
3128
     * @return number Posição vertical final
3129
     */
3130
    protected function modalAquaviario($x = 0, $y = 0)
3131
    {
3132
        $oldX = $x;
3133
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
3134
        if ($this->orientacao == 'P') {
3135
            $maxW = $this->wPrint;
3136
        } else {
3137
            $maxW = $this->wPrint - $this->wCanhoto;
3138
        }
3139
        $w = $maxW;
3140
        $h = 8.5;
3141
        if (!empty($this->detCont)) {
3142
            $texto = 'DETALHAMENTO DO CONTAINER - INFORMAÇÕES ESPECÍFICAS DO MODAL AQUAVIÁRIO';
3143
            $aFont = $this->formatPadrao;
3144
            $this->pdf->textBox($x, $y, $w, $h * 1.3, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3145
            $y += 3.4;
3146
            $this->pdf->line($x, $y, $w + 1, $y);
3147
            $texto = 'LACRE';
3148
            $aFont = $this->formatPadrao;
3149
            $this->pdf->textBox($x, $y, $w * 0.33, $h + 7.5, $texto, $aFont, 'T', 'L', 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...
3150
            $x += $w * 0.50;
3151
            $this->pdf->line($x, $y, $x, $y + 7.5);
3152
            $texto = 'IDENTIFICAÇÃO DO CONTAINER';
3153
            $aFont = $this->formatPadrao;
3154
            $this->pdf->textBox($x, $y, $w * 0.33, $h, $texto, $aFont, 'T', 'L', 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...
3155
            $y += 7.5;
3156
        } else {
3157
            $y += 27.5;
3158
        }
3159
        $texto = 'PREVISÃO DO FLUXO DE CARGA';
3160
        $aFont = $this->formatPadrao;
3161
        $x = $oldX;
3162
        $this->pdf->textBox($x, $y, $w, $h * 1.2, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3163
        $y += 3.4;
3164
        $this->pdf->line($x, $y, $x + $w, $y);
3165
        $texto = 'SIGLA OU CÓDIGO INT. DA FILIAL/PORTO/ESTAÇÃO/AEROPORTO DE ORIGEM';
3166
        $this->pdf->textBox($x, $y, $w * 0.33, $h * 1.2, $texto, $aFont, 'T', '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...
3167
        $fluxo = $this->dom->getElementsByTagName("fluxo")->item(0);
3168
        $texto = $this->getTagValue($fluxo, 'xOrig');
3169
        $this->pdf->textBox($x, $y + 3.5, $w * 0.33, $h * 1.2, $texto, $aFont, 'T', '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...
3170
        $x += $w * 0.33;
3171
        $this->pdf->line($x, $y + 6.5, $x, $y);
3172
        $texto = 'SIGLA OU CÓDIGO INT. DA FILIAL/PORTO/ESTAÇÃO/AEROPORTO DE PASSAGEM';
3173
        $this->pdf->textBox($x, $y, $w * 0.33, $h * 1.2, $texto, $aFont, 'T', '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...
3174
        $pass = $this->dom->getElementsByTagName("pass");
3175
        $texto = '';
3176
        foreach ($pass as $passagem) {
3177
            $texto .= $this->getTagValue($passagem, 'xPass');
3178
        }
3179
        $this->pdf->textBox($x, $y + 3.5, $w * 0.33, $h * 1.2, $texto, $aFont, 'T', '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...
3180
        $x += $w * 0.33;
3181
        $this->pdf->line($x, $y + 6.5, $x, $y);
3182
        $texto = 'SIGLA OU CÓDIGO INT. DA FILIAL/PORTO/ESTAÇÃO/AEROPORTO DE DESTINO';
3183
        $this->pdf->textBox($x, $y, $w * 0.33, $h * 1.3, $texto, $aFont, 'T', '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...
3184
        $texto = $this->getTagValue($fluxo, 'xDest');
3185
        $this->pdf->textBox($x, $y + 3.5, $w * 0.33, $h * 1.3, $texto, $aFont, 'T', '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...
3186
        $x = $oldX;
3187
        $y += 6.8;
3188
        $this->observacao($x, $y);
3189
        $y += $h * 2.2;
3190
        $x = 1;
3191
        $aFont = $this->formatPadrao;
3192
        $texto = '';
3193
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3194
        $texto = 'IDENTIFICAÇÃO DO NAVIO / REBOCADOR';
3195
        $aFont = $this->formatPadrao;
3196
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
3197
        $texto = $this->getTagValue($this->aquav, "xNavio");
3198
        $aFont = $this->formatNegrito;
3199
        $this->pdf->textBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
3200
        $x = $w * 0.33;
3201
        $this->pdf->line($x, $y, $x, $y + $h);
3202
        $texto = 'IDENTIFICAÇÃO DA BALSA';
3203
        $aFont = $this->formatPadrao;
3204
        $this->pdf->textBox($x, $y, $w * 0.23, $h * 2, $texto, $aFont, 'T', 'L', 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...
3205
        $texto = '';
3206
        if ($this->getTagValue($this->aquav, "balsa") !== '') {
3207
            foreach ($this->aquav->getElementsByTagName('balsa') as $k => $d) {
3208
                if ($k == 0) {
3209
                    $texto = $this->aquav
3210
                        ->getElementsByTagName('balsa')
3211
                        ->item($k)
3212
                        ->getElementsByTagName('xBalsa')
3213
                        ->item(0)
3214
                        ->nodeValue;
3215
                } else {
3216
                    $texto = $texto
3217
                        . ' / '
3218
                        . $this->aquav
3219
                            ->getElementsByTagName('balsa')
3220
                            ->item($k)
3221
                            ->getElementsByTagName('xBalsa')
3222
                            ->item(0)
3223
                            ->nodeValue;
3224
                }
3225
            }
3226
        }
3227
        $aFont = $this->formatNegrito;
3228
        $this->pdf->textBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 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...
3229
        $x += $w * 0.33;
3230
        $this->pdf->line($x, $y, $x, $y + 7.7);
3231
        $texto = 'VALOR DO AFRMM';
3232
        $aFont = $this->formatPadrao;
3233
        $this->pdf->textBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 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...
3234
        $texto = number_format($this->getTagValue($this->aquav, "vAFRMM"), 2, ",", ".");
3235
        $aFont = $this->formatNegrito;
3236
        $this->pdf->textBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 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...
3237
        $x = $oldX;
0 ignored issues
show
Unused Code introduced by
$x 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...
3238
        $y += $h;
3239
    }
3240
3241
    /**
3242
     * modalFerr
3243
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
3244
     *
3245
     * @param number $x Posição horizontal canto esquerdo
3246
     * @param number $y Posição vertical canto superior
3247
     * @return number Posição vertical final
3248
     */
3249
    protected function modalFerr($x = 0, $y = 0)
3250
    {
3251
        $oldX = $x;
0 ignored issues
show
Unused Code introduced by
$oldX 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...
3252
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
3253
        if ($this->orientacao == 'P') {
3254
            $maxW = $this->wPrint;
3255
        } else {
3256
            $maxW = $this->wPrint - $this->wCanhoto;
3257
        }
3258
        $w = $maxW;
3259
        $h = 19.6;
3260
        $texto = 'DADOS ESPECÍFICOS DO MODAL FERROVIÁRIO';
3261
        $aFont = $this->formatPadrao;
3262
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3263
        $y += 3.4;
3264
        $this->pdf->line($x, $y, $w + 1, $y);
3265
        $texto = 'DCL';
3266
        $aFont = array(
3267
            'font' => $this->fontePadrao,
3268
            'size' => 7,
3269
            'style' => 'B');
3270
        $this->pdf->textBox($x, $y, $w * 0.25, $h, $texto, $aFont, 'T', '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...
3271
        $this->pdf->line($x + 49.6, $y, $x + 49.6, $y + 3.5);
3272
        $texto = 'VAGÕES';
3273
        $aFont = array(
3274
            'font' => $this->fontePadrao,
3275
            'size' => 7,
3276
            'style' => 'B');
3277
        $this->pdf->textBox($x + 50, $y, $w * 0.5, $h, $texto, $aFont, 'T', '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...
3278
        $y += 3.4;
3279
        $this->pdf->line($x, $y, $w + 1, $y);
3280
        // DCL
3281
        $texto = 'ID TREM';
3282
        $aFont = array(
3283
            'font' => $this->fontePadrao,
3284
            'size' => 6,
3285
            'style' => '');
3286
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3287
        $texto = $this->getTagValue($this->ferrov, "idTrem");
3288
        $aFont = array(
3289
            'font' => $this->fontePadrao,
3290
            'size' => 6,
3291
            'style' => 'B');
3292
        $this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3293
        $x += $w * 0.06;
3294
        $y1 = $y + 12.5;
3295
        $this->pdf->line($x, $y, $x, $y1);
3296
        $texto = 'NUM';
3297
        $aFont = array(
3298
            'font' => $this->fontePadrao,
3299
            'size' => 6,
3300
            'style' => '');
3301
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3302
        $texto = $this->getTagValue($this->rem, "nDoc");
3303
        $aFont = array(
3304
            'font' => $this->fontePadrao,
3305
            'size' => 6,
3306
            'style' => 'B');
3307
        $this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3308
        $x += $w * 0.06;
3309
        $this->pdf->line($x, $y, $x, $y1);
3310
        $texto = 'SÉRIE';
3311
        $aFont = array(
3312
            'font' => $this->fontePadrao,
3313
            'size' => 6,
3314
            'style' => '');
3315
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3316
        $texto = $this->getTagValue($this->rem, "serie");
3317
        $aFont = array(
3318
            'font' => $this->fontePadrao,
3319
            'size' => 6,
3320
            'style' => 'B');
3321
        $this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3322
        $x += $w * 0.06;
3323
        $this->pdf->line($x, $y, $x, $y1);
3324
        $texto = 'EMISSÃO';
3325
        $aFont = array(
3326
            'font' => $this->fontePadrao,
3327
            'size' => 6,
3328
            'style' => '');
3329
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3330
        $texto = $this->ymdTodmy($this->getTagValue($this->rem, "dEmi"));
3331
        $aFont = array(
3332
            'font' => $this->fontePadrao,
3333
            'size' => 6,
3334
            'style' => 'B');
3335
        $this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3336
        // VAGOES
3337
        $x += $w * 0.06;
3338
        $this->pdf->line($x, $y, $x, $y1);
3339
        $texto = 'NUM';
3340
        $aFont = array(
3341
            'font' => $this->fontePadrao,
3342
            'size' => 6,
3343
            'style' => '');
3344
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3345
        $texto = $this->getTagValue($this->ferrov, "nVag");
3346
        $aFont = array(
3347
            'font' => $this->fontePadrao,
3348
            'size' => 6,
3349
            'style' => 'B');
3350
        $this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3351
        $x += $w * 0.06;
3352
        $this->pdf->line($x, $y, $x, $y1);
3353
        $texto = 'TIPO';
3354
        $aFont = array(
3355
            'font' => $this->fontePadrao,
3356
            'size' => 6,
3357
            'style' => '');
3358
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3359
        $texto = $this->getTagValue($this->ferrov, "tpVag");
3360
        $aFont = array(
3361
            'font' => $this->fontePadrao,
3362
            'size' => 6,
3363
            'style' => 'B');
3364
        $this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3365
        $x += $w * 0.06;
3366
        $this->pdf->line($x, $y, $x, $y1);
3367
        $texto = 'CAPACIDADE';
3368
        $aFont = array(
3369
            'font' => $this->fontePadrao,
3370
            'size' => 6,
3371
            'style' => '');
3372
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3373
        $texto = $this->getTagValue($this->ferrov, "cap");
3374
        $aFont = array(
3375
            'font' => $this->fontePadrao,
3376
            'size' => 6,
3377
            'style' => 'B');
3378
        $this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3379
        $x += $w * 0.08;
3380
        $this->pdf->line($x, $y, $x, $y1);
3381
        $texto = 'PESO REAL/TON';
3382
        $aFont = array(
3383
            'font' => $this->fontePadrao,
3384
            'size' => 6,
3385
            'style' => '');
3386
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3387
        $texto = $this->getTagValue($this->ferrov, "pesoR");
3388
        $aFont = array(
3389
            'font' => $this->fontePadrao,
3390
            'size' => 6,
3391
            'style' => 'B');
3392
        $this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3393
        $x += $w * 0.09;
3394
        $this->pdf->line($x, $y, $x, $y1);
3395
        $texto = 'PESO BRUTO/TON';
3396
        $aFont = array(
3397
            'font' => $this->fontePadrao,
3398
            'size' => 6,
3399
            'style' => '');
3400
        $this->pdf->textBox($x, $y, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3401
        $texto = $this->getTagValue($this->ferrov, "pesoBC");
3402
        $aFont = array(
3403
            'font' => $this->fontePadrao,
3404
            'size' => 6,
3405
            'style' => 'B');
3406
        $this->pdf->textBox($x, $y + 3, $w * 0.10, $h, $texto, $aFont, 'T', 'L', 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...
3407
        $x += $w * 0.1;
3408
        $this->pdf->line($x, $y, $x, $y1);
3409
        $texto = 'IDENTIFICAÇÃO DOS CONTÊINERES';
3410
        $aFont = array(
3411
            'font' => $this->fontePadrao,
3412
            'size' => 6,
3413
            'style' => '');
3414
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
3415
        $texto = $this->getTagValue($this->ferrov, "nCont");
3416
        $aFont = array(
3417
            'font' => $this->fontePadrao,
3418
            'size' => 6,
3419
            'style' => 'B');
3420
        $this->pdf->textBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
3421
        // FLUXO
3422
        $x = 1;
3423
        $y += 12.9;
3424
        $h1 = $h * 0.5 + 0.27;
3425
        $wa = round($w * 0.103) + 0.5;
3426
        $texto = 'FLUXO FERROVIARIO';
3427
        $aFont = $this->formatPadrao;
3428
        $this->pdf->textBox($x, $y, $wa, $h1, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3429
        $texto = $this->getTagValue($this->ferrov, "fluxo");
3430
        $aFont = array(
3431
            'font' => $this->fontePadrao,
3432
            'size' => 7,
3433
            'style' => 'B');
3434
        $this->pdf->textBox($x, $y + 3, $wa, $h1, $texto, $aFont, 'T', '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...
3435
        $y += 10;
3436
        $texto = 'TIPO DE TRÁFEGO';
3437
        $aFont = $this->formatPadrao;
3438
        $this->pdf->textBox($x, $y, $wa, $h1, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3439
        $texto = $this->convertUnidTrafego($this->getTagValue($this->ferrov, "tpTraf"));
3440
        $aFont = array(
3441
            'font' => $this->fontePadrao,
3442
            'size' => 7,
3443
            'style' => 'B');
3444
        $this->pdf->textBox($x, $y + 3, $wa, $h1, $texto, $aFont, 'T', '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...
3445
        // Novo Box Relativo a Modal Ferroviário
3446
        $x = 22.5;
3447
        $y += -10.2;
3448
        $texto = 'INFORMAÇÕES DAS FERROVIAS ENVOLVIDAS';
3449
        $aFont = $this->formatPadrao;
3450
        $this->pdf->textBox($x, $y, $w - 21.5, $h1 * 2.019, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3451
        $y += 3.4;
3452
        $this->pdf->line($x, $y, $w + 1, $y);
3453
        $w = $w * 0.2;
3454
        $h = $h * 1.04;
3455
        $texto = 'CÓDIGO INTERNO';
3456
        $aFont = array(
3457
            'font' => $this->fontePadrao,
3458
            'size' => 6,
3459
            'style' => '');
3460
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
3461
        $texto = $this->getTagValue($this->ferrov, "cInt");
3462
        $aFont = array(
3463
            'font' => $this->fontePadrao,
3464
            'size' => 6,
3465
            'style' => 'B');
3466
        $this->pdf->textBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
3467
        $texto = 'CNPJ';
3468
        $aFont = array(
3469
            'font' => $this->fontePadrao,
3470
            'size' => 6,
3471
            'style' => '');
3472
        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'L', 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...
3473
        $texto = $this->getTagValue($this->ferrov, "CNPJ");
3474
        $aFont = array(
3475
            'font' => $this->fontePadrao,
3476
            'size' => 6,
3477
            'style' => 'B');
3478
        $this->pdf->textBox($x, $y + 9, $w, $h, $texto, $aFont, 'T', 'L', 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...
3479
        $x += 50;
3480
        $texto = 'NOME';
3481
        $aFont = array(
3482
            'font' => $this->fontePadrao,
3483
            'size' => 6,
3484
            'style' => '');
3485
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 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...
3486
        $texto = $this->getTagValue($this->ferrov, "xNome");
3487
        $aFont = array(
3488
            'font' => $this->fontePadrao,
3489
            'size' => 6,
3490
            'style' => 'B');
3491
        $this->pdf->textBox($x, $y + 3, $w, $h, $texto, $aFont, 'T', 'L', 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...
3492
        $texto = 'INSCRICAO ESTADUAL';
3493
        $aFont = array(
3494
            'font' => $this->fontePadrao,
3495
            'size' => 6,
3496
            'style' => '');
3497
        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'L', 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...
3498
        $texto = $this->getTagValue($this->ferrov, "IE");
3499
        $aFont = array(
3500
            'font' => $this->fontePadrao,
3501
            'size' => 6,
3502
            'style' => 'B');
3503
        $this->pdf->textBox($x, $y + 9, $w, $h, $texto, $aFont, 'T', 'L', 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...
3504
        $x += 50;
3505
        $texto = 'PARTICIPAÇÃO OUTRA FERROVIA';
3506
        $aFont = array(
3507
            'font' => $this->fontePadrao,
3508
            'size' => 6,
3509
            'style' => '');
3510
        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'L', 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...
3511
        $texto = '';
3512
        $aFont = array(
3513
            'font' => $this->fontePadrao,
3514
            'size' => 6,
3515
            'style' => 'B');
3516
        $this->pdf->textBox($x, $y + 9, $w, $h, $texto, $aFont, 'T', 'L', 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...
3517
    }
3518
3519
    /**
3520
     * canhoto
3521
     * Monta o campo com os dados do remetente na DACTE.
3522
     *
3523
     * @param number $x Posição horizontal canto esquerdo
3524
     * @param number $y Posição vertical canto superior
3525
     * @return number Posição vertical final
3526
     */
3527
    protected function canhoto($x = 0, $y = 0)
3528
    {
3529
        $oldX = $x;
3530
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
3531
        if ($this->orientacao == 'P') {
3532
            $maxW = $this->wPrint;
3533
        } else {
3534
            $maxW = $this->wPrint - $this->wCanhoto;
3535
        }
3536
        $w = $maxW - 1;
3537
        $h = 20;
3538
        $y = $y + 1;
3539
        $texto = 'DECLARO QUE RECEBI OS VOLUMES DESTE CONHECIMENTO EM PERFEITO ESTADO ';
3540
        $texto .= 'PELO QUE DOU POR CUMPRIDO O PRESENTE CONTRATO DE TRANSPORTE';
3541
        $aFont = $this->formatPadrao;
3542
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3543
        $y += 3.4;
3544
        $this->pdf->line($x, $y, $w + 1, $y); // LINHA ABAICO DO TEXTO DECLARO QUE RECEBI...
3545
        $texto = 'NOME';
3546
        $aFont = array(
3547
            'font' => $this->fontePadrao,
3548
            'size' => 6,
3549
            'style' => '');
3550
        $this->pdf->textBox($x, $y, $w * 0.25, $h, $texto, $aFont, 'T', 'L', 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...
3551
        $x += $w * 0.25;
3552
        $this->pdf->line($x, $y, $x, $y + 16.5);
3553
        $texto = 'ASSINATURA / CARIMBO';
3554
        $aFont = array(
3555
            'font' => $this->fontePadrao,
3556
            'size' => 6,
3557
            'style' => '');
3558
        $this->pdf->textBox($x, $y, $w * 0.25, $h - 3.4, $texto, $aFont, 'B', '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...
3559
        $x += $w * 0.25;
3560
        $this->pdf->line($x, $y, $x, $y + 16.5);
3561
        $texto = 'TÉRMINO DA PRESTAÇÃO - DATA/HORA' . "\r\n" . "\r\n" . "\r\n" . "\r\n";
3562
        $texto .= ' INÍCIO DA PRESTAÇÃO - DATA/HORA';
3563
        $aFont = array(
3564
            'font' => $this->fontePadrao,
3565
            'size' => 6,
3566
            'style' => '');
3567
        $this->pdf->textBox($x + 10, $y, $w * 0.25, $h - 3.4, $texto, $aFont, 'T', '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...
3568
        $x = $oldX;
3569
        $y = $y + 5;
3570
        $this->pdf->line($x, $y + 3, $w * 0.255, $y + 3); // LINHA HORIZONTAL ACIMA DO RG ABAIXO DO NOME
3571
        $texto = 'RG';
3572
        $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => ''];
3573
        $this->pdf->textBox($x, $y + 3, $w * 0.33, $h, $texto, $aFont, 'T', 'L', 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...
3574
        $x += $w * 0.85;
3575
        $this->pdf->line($x, $y + 11.5, $x, $y - 5); // LINHA VERTICAL PROXIMO AO CT-E
3576
        $texto = "CT-E";
3577
        $aFont = $this->formatNegrito;
3578
        $this->pdf->textBox($x, $y - 5, $w * 0.15, $h, $texto, $aFont, 'T', '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...
3579
        $numCTe = str_pad($this->getTagValue($this->ide, "nCT"), 9, '0', STR_PAD_LEFT);
3580
        $texto = "Nº. " . $this->formatField($numCTe, "###.###.###") . "\n";
3581
        //$texto = "\r\n Nº. DOCUMENTO  " . $this->getTagValue($this->ide, "nCT") . " \n";
3582
        $numSerie = str_pad($this->getTagValue($this->ide, "serie"), 3, '0', STR_PAD_LEFT);
3583
        $texto .= "Série {$numSerie}";
3584
        //$texto .= "\r\n SÉRIE  " . $this->getTagValue($this->ide, "serie");
3585
        $aFont = array(
3586
            'font' => $this->fontePadrao,
3587
            'size' => 10,
3588
            'style' => '');
3589
        $this->pdf->textBox($x, $y - 8, $w * 0.15, $h, $texto, $aFont, '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...
3590
        $x = $oldX;
3591
        $this->pdf->dashedHLine($x, $y + 12.7, $this->wPrint, 0.1, 80);
3592
    }
3593
3594
    /**
3595
     * dadosAdic
3596
     * Coloca o grupo de dados adicionais da DACTE.
3597
     *
3598
     * @param number $x Posição horizontal canto esquerdo
3599
     * @param number $y Posição vertical canto superior
3600
     * @param number $h altura do campo
3601
     * @return number Posição vertical final
3602
     */
3603
    protected function dadosAdic($x, $y, $pag, $h)
0 ignored issues
show
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 $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...
3604
    {
3605
        $oldX = $x;
0 ignored issues
show
Unused Code introduced by
$oldX 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...
3606
        //###########################################################################
3607
        //DADOS ADICIONAIS DACTE
3608
        if ($this->orientacao == 'P') {
3609
            $w = $this->wPrint;
0 ignored issues
show
Unused Code introduced by
$w 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...
3610
        } else {
3611
            $w = $this->wPrint - $this->wCanhoto;
0 ignored issues
show
Unused Code introduced by
$w 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...
3612
        }
3613
        //INFORMAÇÕES COMPLEMENTARES
3614
        $texto = "USO EXCLUSIVO DO EMISSOR DO CT-E";
3615
        $y += 3;
3616
        $w = $this->wAdic;
3617
        $h = 8; //mudar
3618
        $aFont = array(
3619
            'font' => $this->fontePadrao,
3620
            'size' => 6,
3621
            'style' => '');
3622
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3623
        //$this->pdf->line($x, $y + 3, $w * 1.385, $y + 3);
3624
        $this->pdf->line($x, $y + 3, $w * 1.385, $y + 3);
3625
        //o texto com os dados adicionais foi obtido na função xxxxxx
3626
        //e carregado em uma propriedade privada da classe
3627
        //$this->wAdic com a largura do campo
3628
        //$this->textoAdic com o texto completo do campo
3629
        $y += 1;
3630
        $aFont = $this->formatPadrao;
3631
        $this->pdf->textBox($x, $y + 3, $w - 2, $h - 3, $this->textoAdic, $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...
3632
        //RESERVADO AO FISCO
3633
        $texto = "RESERVADO AO FISCO";
3634
        $x += $w;
3635
        $y -= 1;
3636
        if ($this->orientacao == 'P') {
3637
            $w = $this->wPrint - $w;
3638
        } else {
3639
            $w = $this->wPrint - $w - $this->wCanhoto;
3640
        }
3641
        $aFont = array(
3642
            'font' => $this->fontePadrao,
3643
            'size' => 6,
3644
            'style' => '');
3645
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 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...
3646
        //inserir texto informando caso de contingência
3647
        //1 – Normal – emissão normal;
3648
        //2 – Contingência FS – emissão em contingência com impressão do DACTE em Formulário de Segurança;
3649
        //3 – Contingência SCAN – emissão em contingência  – SCAN;
3650
        //4 – Contingência DPEC - emissão em contingência com envio da Declaração Prévia de
3651
        //Emissão em Contingência – DPEC;
3652
        //5 – Contingência FS-DA - emissão em contingência com impressão do DACTE em Formulário de
3653
        //Segurança para Impressão de Documento Auxiliar de Documento Fiscal Eletrônico (FS-DA).
3654
        $xJust = $this->getTagValue($this->ide, 'xJust', 'Justificativa: ');
3655
        $dhCont = $this->getTagValue($this->ide, 'dhCont', ' Entrada em contingência : ');
3656
        $texto = '';
3657
        switch ($this->tpEmis) {
3658
            case 2:
3659
                $texto = 'CONTINGÊNCIA FS' . $dhCont . $xJust;
3660
                break;
3661
            case 3:
3662
                $texto = 'CONTINGÊNCIA SCAN' . $dhCont . $xJust;
3663
                break;
3664
            case 4:
3665
                $texto = 'CONTINGÊNCIA DPEC' . $dhCont . $xJust;
3666
                break;
3667
            case 5:
3668
                $texto = 'CONTINGÊNCIA FSDA' . $dhCont . $xJust;
3669
                break;
3670
        }
3671
        $y += 2;
3672
        $aFont = $this->formatPadrao;
3673
        $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $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...
3674
        return $y + $h;
3675
    }
3676
3677
    /**
3678
     * formatCNPJCPF
3679
     * Formata campo CnpjCpf contida na CTe
3680
     *
3681
     * @param string $field campo cnpjCpf da CT-e
3682
     * @return string
3683
     */
3684
    protected function formatCNPJCPF($field)
3685
    {
3686
        if (!isset($field)) {
3687
            return '';
3688
        }
3689
        $cnpj = !empty($field->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
0 ignored issues
show
Bug introduced by
The method getElementsByTagName cannot be called on $field (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
3690
            $field->getElementsByTagName("CNPJ")->item(0)->nodeValue : "";
0 ignored issues
show
Bug introduced by
The method getElementsByTagName cannot be called on $field (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
3691
        if ($cnpj != "" && $cnpj != "00000000000000") {
3692
            $cnpj = $this->formatField($cnpj, '###.###.###/####-##');
3693
        } else {
3694
            $cnpj = !empty($field->getElementsByTagName("CPF")->item(0)->nodeValue) ?
0 ignored issues
show
Bug introduced by
The method getElementsByTagName cannot be called on $field (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
3695
                $this->formatField($field->getElementsByTagName("CPF")->item(0)->nodeValue, '###.###.###.###-##') : '';
0 ignored issues
show
Bug introduced by
The method getElementsByTagName cannot be called on $field (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
3696
        }
3697
        return $cnpj;
3698
    }
3699
3700
    /**
3701
     * formatFone
3702
     * Formata campo fone contida na CTe
3703
     *
3704
     * @param string $field campo fone da CT-e
3705
     * @return string
3706
     */
3707
    protected function formatFone($field)
3708
    {
3709
        try {
3710
            $fone = !empty($field->getElementsByTagName("fone")->item(0)->nodeValue) ?
0 ignored issues
show
Bug introduced by
The method getElementsByTagName cannot be called on $field (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
3711
                $field->getElementsByTagName("fone")->item(0)->nodeValue : '';
0 ignored issues
show
Bug introduced by
The method getElementsByTagName cannot be called on $field (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
3712
            $foneLen = strlen($fone);
3713
            if ($foneLen > 0) {
3714
                $fone2 = substr($fone, 0, $foneLen - 4);
3715
                $fone1 = substr($fone, 0, $foneLen - 8);
3716
                $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4);
3717
            } else {
3718
                $fone = '';
3719
            }
3720
            return $fone;
3721
        } catch (Exception $exc) {
3722
            return '';
3723
        }
3724
    }
3725
3726
    /**
3727
     * unidade
3728
     * Converte a imformação de peso contida na CTe
3729
     *
3730
     * @param string $c unidade de trafego extraida da CTe
3731
     * @return string
3732
     */
3733
    protected function unidade($c = '')
3734
    {
3735
        switch ($c) {
3736
            case '00':
3737
                $r = 'M3';
3738
                break;
3739
            case '01':
3740
                $r = 'KG';
3741
                break;
3742
            case '02':
3743
                $r = 'TON';
3744
                break;
3745
            case '03':
3746
                $r = 'UN';
3747
                break;
3748
            case '04':
3749
                $r = 'LT';
3750
                break;
3751
            case '05':
3752
                $r = 'MMBTU';
3753
                break;
3754
            default:
3755
                $r = '';
3756
        }
3757
        return $r;
3758
    }
3759
3760
    /**
3761
     * convertUnidTrafego
3762
     * Converte a imformação de peso contida na CTe
3763
     *
3764
     * @param string $U Informação de trafego extraida da CTe
3765
     * @return string
3766
     */
3767
    protected function convertUnidTrafego($U = '')
3768
    {
3769
        if ($U) {
3770
            switch ($U) {
3771
                case '0':
3772
                    $stringU = 'Próprio';
3773
                    break;
3774
                case '1':
3775
                    $stringU = 'Mútuo';
3776
                    break;
3777
                case '2':
3778
                    $stringU = 'Rodoferroviário';
3779
                    break;
3780
                case '3':
3781
                    $stringU = 'Rodoviário';
3782
                    break;
3783
            }
3784
            return $stringU;
0 ignored issues
show
Bug introduced by
The variable $stringU 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...
3785
        }
3786
    }
3787
3788
    /**
3789
     * multiUniPeso
3790
     * Fornece a imformação multiplicação de peso contida na CTe
3791
     *
3792
     * @param interger $U Informação de peso extraida da CTe
3793
     * @return interger
3794
     */
3795
    protected function multiUniPeso($U = '')
3796
    {
3797
        if ($U === "01") {
3798
            // tonelada
3799
            //return 1000;
3800
            return 1;
3801
        }
3802
        return 1; // M3, KG, Unidade, litros, mmbtu
3803
    }
3804
3805
    protected function qrCodeDacte($y = 0)
3806
    {
3807
        $margemInterna = $this->margemInterna;
3808
        $barcode = new Barcode();
3809
        $bobj = $barcode->getBarcodeObj(
3810
            'QRCODE,M',
3811
            $this->qrCodCTe,
3812
            -4,
3813
            -4,
3814
            'black',
3815
            array(-2, -2, -2, -2)
3816
        )->setBackgroundColor('white');
3817
        $qrcode = $bobj->getPngData();
3818
        $wQr = 36;
3819
        $hQr = 36;
3820
        $yQr = ($y + $margemInterna);
3821
        if ($this->orientacao == 'P') {
3822
            $xQr = 170;
3823
        } else {
3824
            $xQr = 250;
3825
        }
3826
        // prepare a base64 encoded "data url"
3827
        $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
3828
        $this->pdf->image($pic, $xQr - 3, $yQr, $wQr, $hQr, 'PNG');
3829
    }
3830
}
3831