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

DacteOS::statusCTe()   D

Complexity

Conditions 22
Paths 21

Size

Total Lines 53

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 506

Importance

Changes 0
Metric Value
cc 22
nc 21
nop 0
dl 0
loc 53
ccs 0
cts 53
cp 0
crap 506
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 DacteOS extends DaCommon
25
{
26
    protected $yDados = 0;
27
    protected $xml;
28
    protected $errMsg = '';
29
    protected $errStatus = false;
30
31
    protected $dom;
32
    protected $infCte;
33
    protected $infPercurso;
34
    protected $infCteComp;
35
    protected $chaveCTeRef;
36
    protected $tpCTe;
37
    protected $ide;
38
    protected $emit;
39
    protected $enderEmit;
40
    protected $infCarga;
41
    protected $infQ;
42
    protected $seg;
43
    protected $modal;
44
    protected $rodo;
45
    protected $moto;
46
    protected $veic;
47
    protected $ferrov;
48
    protected $Comp;
49
    protected $infNF;
50
    protected $infNFe;
51
    protected $compl;
52
    protected $ICMS;
53
    protected $imp;
54
    protected $toma4;
55
    protected $toma03;
56
    protected $tpEmis;
57
    protected $tpImp;
58
    protected $tpAmb;
59
    protected $vPrest;
60
    protected $infServico;
61
    protected $aquav;
62
63
    protected $wAdic = 150;
64
    protected $textoAdic = '';
65
    protected $formatPadrao;
66
    protected $formatNegrito;
67
68
    protected $preVisualizar;
69
    protected $flagDocOrigContinuacao;
70
    protected $arrayNFe = array();
71
    protected $siteDesenvolvedor;
72
    protected $nomeDesenvolvedor;
73
    protected $totPag;
74
    protected $idDocAntEle = [];
75
    protected $lota;
76
    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
77
    protected $margemInterna = 0;
78
79
    /**
80
     * __construct
81
     *
82
     * @param string $xml Arquivo XML da CTeOS
83
     */
84
    public function __construct(
85
        $xml
86
    ) {
87
        $this->loadDoc($xml);
88
    }
89
90
    private function loadDoc($xml)
91
    {
92
        $this->xml = $xml;
93
        if (!empty($xml)) {
94
            $this->dom = new Dom();
95
            $this->dom->loadXML($this->xml);
96
            $this->cteProc = $this->dom->getElementsByTagName("cteOSProc")->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...
97
            if (empty($this->dom->getElementsByTagName("infCte")->item(0))) {
98
                throw new \Exception('Isso não é um CT-e.');
99
            }
100
            $this->infCte = $this->dom->getElementsByTagName("infCte")->item(0);
101
            $this->ide = $this->dom->getElementsByTagName("ide")->item(0);
102
            if ($this->getTagValue($this->ide, "mod") != '67') {
103
                throw new \Exception("O xml deve ser CT-e modelo 67.");
104
            }
105
            $this->emit = $this->dom->getElementsByTagName("emit")->item(0);
106
            $this->enderEmit = $this->dom->getElementsByTagName("enderEmit")->item(0);
107
            $this->infPercurso = $this->dom->getElementsByTagName("infPercurso");
108
            $this->infCarga = $this->dom->getElementsByTagName("infCarga")->item(0);
109
            $this->infQ = $this->dom->getElementsByTagName("infQ");
110
            $this->seg = $this->dom->getElementsByTagName("seg")->item(0);
111
            $this->rodo = $this->dom->getElementsByTagName("rodoOS")->item(0);
112
            $this->veic = $this->dom->getElementsByTagName("veic");
113
            $this->ferrov = $this->dom->getElementsByTagName("ferrov")->item(0);
114
            // adicionar outros modais
115
            $this->infCteComp = $this->dom->getElementsByTagName("infCteComp")->item(0);
116
            $this->chaveCTeRef = $this->getTagValue($this->infCteComp, "chave");
117
            $this->vPrest = $this->dom->getElementsByTagName("vPrest")->item(0);
118
            $this->Comp = $this->dom->getElementsByTagName("Comp");
119
            $this->infNF = $this->dom->getElementsByTagName("infNF");
120
            $this->infNFe = $this->dom->getElementsByTagName("infNFe");
121
            $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...
122
            $this->infServico = $this->dom->getElementsByTagName("infServico");
123
            $this->compl = $this->dom->getElementsByTagName("compl");
124
            $this->ICMS = $this->dom->getElementsByTagName("ICMS")->item(0);
125
            $this->ICMSSN = $this->dom->getElementsByTagName("ICMSSN")->item(0);
0 ignored issues
show
Bug introduced by
The property ICMSSN 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...
126
            $this->imp = $this->dom->getElementsByTagName("imp")->item(0);
127
128
            $vTrib = $this->getTagValue($this->imp, "vTotTrib");
129
            if (!is_numeric($vTrib)) {
130
                $vTrib = 0;
131
            }
132
            $textoAdic = number_format($vTrib, 2, ",", ".");
133
            $this->textoAdic = "o valor aproximado de tributos incidentes sobre o preço deste serviço é de R$"
134
                .$textoAdic;
135
            $this->toma = $this->dom->getElementsByTagName("toma")->item(0);
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...
136
            $this->enderToma = $this->getTagValue($this->toma, "enderToma");
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...
137
            //modal aquaviário
138
            $this->aquav = $this->dom->getElementsByTagName("aquav")->item(0);
139
            $seguro = $this->getTagValue($this->seg, "respSeg");
140
            $this->xSeg = $this->getTagValue($this->seg, "xSeg");
0 ignored issues
show
Bug introduced by
The property xSeg 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...
141
            $this->nApol = $this->getTagValue($this->seg, "nApol");
0 ignored issues
show
Bug introduced by
The property nApol 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...
142
            switch ($seguro) {
143
                case '4':
144
                    $this->respSeg = 'Emitente';
0 ignored issues
show
Bug introduced by
The property respSeg 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...
145
                    break;
146
                case '5':
147
                    $this->respSeg = 'Tomador do Serviço';
148
                    break;
149
                default:
150
                    $this->respSeg = '';
151
                    break;
152
            }
153
            $this->tpEmis = $this->getTagValue($this->ide, "tpEmis");
154
            $this->tpImp = $this->getTagValue($this->ide, "tpImp");
155
            $this->tpAmb = $this->getTagValue($this->ide, "tpAmb");
156
            $this->tpCTe = $this->getTagValue($this->ide, "tpCTe");
157
            $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...
158
            $this->qrCodMDFe = $this->dom->getElementsByTagName('qrCodCTe')->item(0) ?
0 ignored issues
show
Bug introduced by
The property qrCodMDFe 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...
159
                $this->dom->getElementsByTagName('qrCodCTe')->item(0)->nodeValue : 'SEM INFORMAÇÃO DE QRCODE';
160
            //01-Rodoviário; //02-Aéreo; //03-Aquaviário; //04-Ferroviário;//05-Dutoviário
161
            $this->modal = $this->getTagValue($this->ide, "modal");
162
        }
163
    }
164
165
    /**
166
     * montaDACTE
167
     * Esta função monta a DACTE conforme as informações fornecidas para a classe
168
     * durante sua construção.
169
     * A definição de margens e posições iniciais para a impressão são estabelecidas no
170
     * pelo conteúdo da funçao e podem ser modificados.
171
     *
172
     * @param  string $logo
173
     * @return string O ID da NFe numero de 44 digitos extraido do arquivo XML
174
     */
175
    protected function monta(
176
        $logo = ''
177
    ) {
178
        $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...
179
        if (!empty($logo)) {
180
            $this->logomarca = $this->adjustImage($logo);
181
        }
182
        //se a orientação estiver em branco utilizar o padrão estabelecido na NF
183
        if ($this->orientacao == '') {
184
            if ($this->tpImp == '1') {
185
                $this->orientacao = 'P';
186
            } else {
187
                $this->orientacao = 'P';
188
            }
189
        }
190
        //instancia a classe pdf
191
        $margSup = $this->margsup;
192
        $margEsq = $this->margesq;
193
        $margDir = $this->margesq;
194
195
        $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...
196
        $this->formatPadrao = array(
197
            'font' => $this->fontePadrao,
198
            'size' => 6,
199
            'style' => '');
200
        $this->formatNegrito = array(
201
            'font' => $this->fontePadrao,
202
            'size' => 7,
203
            'style' => 'B');
204
        if ($this->orientacao == 'P') {
205
            // posição inicial do relatorio
206
            $xInic = 1;
207
            $yInic = 1;
208
            if ($this->papel == 'A4') {
209
                //A4 210x297mm
210
                $maxW = 210;
211
                $maxH = 297;
212
            }
213
        } else {
214
            // posição inicial do relatorio
215
            $xInic = 5;
216
            $yInic = 5;
217
            if ($this->papel == 'A4') {
218
                //A4 210x297mm
219
                $maxH = 210;
220
                $maxW = 297;
221
                $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...
222
            }
223
        }
224
        //total inicial de paginas
225
        $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...
226
        //largura imprimivel em mm
227
        $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...
228
        //comprimento imprimivel em mm
229
        $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...
230
        // estabelece contagem de paginas
231
        $this->pdf->aliasNbPages();
232
        // fixa as margens
233
        $this->pdf->setMargins($margEsq, $margSup, $margDir);
234
        $this->pdf->setDrawColor(0, 0, 0);
235
        $this->pdf->setFillColor(255, 255, 255);
236
        // inicia o documento
237
        $this->pdf->open();
238
        // adiciona a primeira página
239
        $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...
240
        $this->pdf->setLineWidth(0.1);
241
        $this->pdf->setTextColor(0, 0, 0);
242
        //calculo do numero de páginas ???
243
        $totPag = 1;
244
        //montagem da primeira página
245
        $pag = 1;
246
        $x = $xInic;
247
        $y = $yInic;
248
        //coloca o cabeçalho
249
        //$r = $this->cabecalho($x, $y, $pag, $totPag);
250
        $y += 70;
251
        $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...
252
        if ($this->tpCTe == '0') {
253
            //Normal
254
            $y += 10;
255
            $x = $xInic;
256
            //$r = $this->zDocOrig($x, $y);
257
            $r = $this->infPrestacaoServico($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...
258
            $y += 53;
259
            $x = $xInic;
260
            $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...
261
            $y += 25;
262
            $x = $xInic;
263
            $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...
264
            $y += 13;
265
            $x = $xInic;
266
            $r = $this->observacoes($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...
267
            $y += 19;
268
            $x = $xInic;
269
            $r = $this->seguro($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...
270
            $y = $y-12;
271
            switch ($this->modal) {
272
                case '1':
273
                    $y += 24.9;
274
                    $x = $xInic;
275
                    $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...
276
                    break;
277
                case '2':
278
                    $y += 17.9;
279
                    $x = $xInic;
280
                    // TODO fmertins 31/10/14: este método não existe...
281
                    $r = $this->modalAereo($x, $y);
0 ignored issues
show
Bug introduced by
The method modalAereo() does not seem to exist on object<NFePHP\DA\CTe\DacteOS>.

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...
282
                    break;
283
                case '3':
284
                    $y += 17.9;
285
                    $x = $xInic;
286
                    $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...
287
                    break;
288
                case '4':
289
                    $y += 17.9;
290
                    $x = $xInic;
291
                    $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...
292
                    break;
293
                case '5':
294
                    $y += 17.9;
295
                    $x = $xInic;
296
                    // TODO fmertins 31/10/14: este método não existe...
297
                    $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\DacteOS>.

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...
298
                    break;
299
            }
300
            if ($this->modal == '1') {
301
                if ($this->lota == 1) {
302
                    $y += 37;
303
                } else {
304
                    $y += 8.9;
305
                }
306
            } elseif ($this->modal == '3') {
307
                $y += 24.15;
308
            } else {
309
                $y += 37;
310
            }
311
        } else {
312
            $r = $this->cabecalho(1, 1, $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...
313
            //Complementado
314
            $y += 10;
315
            $x = $xInic;
316
            $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...
317
            $y += 80;
318
            $x = $xInic;
319
            $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...
320
            $y += 25;
321
            $x = $xInic;
322
            $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...
323
            $y += 13;
324
            $x = $xInic;
325
            $r = $this->observacoes($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...
326
            $y += 15;
327
        }
328
        $x = $xInic;
329
        $y += 1;
330
        $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...
331
332
        $y += 21;
333
        //$y += 11;
334
        $y = $this->canhoto($x, $y);
0 ignored issues
show
Unused Code introduced by
$y is not used, you could remove the assignment.

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

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

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

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

Loading history...
335
336
        //coloca o rodapé da página
337
        if ($this->orientacao == 'P') {
338
            $this->rodape(2, $this->hPrint - 2);
339
        } else {
340
            $this->rodape($xInic, $this->hPrint + 2.3);
341
        }
342
        if ($this->flagDocOrigContinuacao == 1) {
343
            $this->docOrigContinuacao(1, 71);
0 ignored issues
show
Bug introduced by
The method docOrigContinuacao() does not seem to exist on object<NFePHP\DA\CTe\DacteOS>.

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...
344
        }
345
    }
346
347
    /**
348
     * cabecalho
349
     * Monta o cabelhalho da DACTE ( retrato e paisagem )
350
     *
351
     * @param  number $x Posição horizontal inicial, canto esquerdo
352
     * @param  number $y Posição vertical inicial, canto superior
353
     * @param  number $pag Número da Página
354
     * @param  number $totPag Total de páginas
355
     * @return number Posição vertical final
356
     */
357
    protected function cabecalho($x = 0, $y = 0, $pag = '1', $totPag = '1')
0 ignored issues
show
Unused Code introduced by
The parameter $totPag is not used and could be removed.

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

Loading history...
358
    {
359
        $oldX = $x;
360
        $oldY = $y;
361
        if ($this->orientacao == 'P') {
362
            $maxW = $this->wPrint;
363
        } else {
364
            if ($pag == 1) {
365
                // primeira página
366
                $maxW = $this->wPrint - $this->wCanhoto;
367
            } else {
368
                // páginas seguintes
369
                $maxW = $this->wPrint;
370
            }
371
        }
372
        //##################################################################
373
        //coluna esquerda identificação do emitente
374
        $w = round($maxW * 0.42);
375
        if ($this->orientacao == 'P') {
376
            $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...
377
                'font' => $this->fontePadrao,
378
                'size' => 6,
379
                'style' => '');
380
        } else {
381
            $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...
382
        }
383
        $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...
384
        $h = 35;
385
        $oldY += $h;
386
        //desenha a caixa
387
        $this->pdf->textBox($x, $y, $w + 2, $h + 1);
388
        // coloca o logo
389
        if (!empty($this->logomarca)) {
390
            $logoInfo = getimagesize($this->logomarca);
391
            //largura da imagem em mm
392
            $logoWmm = ($logoInfo[0] / 72) * 25.4;
393
            //altura da imagem em mm
394
            $logoHmm = ($logoInfo[1] / 72) * 25.4;
395
            if ($this->logoAlign == 'L') {
396
                $nImgW = round($w / 3, 0);
397
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
398
                $xImg = $x + 1;
399
                $yImg = round(($h - $nImgH) / 2, 0) + $y;
400
                //estabelecer posições do texto
401
                $x1 = round($xImg + $nImgW + 1, 0);
402
                $y1 = round($h / 3 + $y, 0);
403
                $tw = round(2 * $w / 3, 0);
404
            } elseif ($this->logoAlign == 'C') {
405
                $nImgH = round($h / 3, 0);
406
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
407
                $xImg = round(($w - $nImgW) / 2 + $x, 0);
408
                $yImg = $y + 3;
409
                $x1 = $x;
410
                $y1 = round($yImg + $nImgH + 1, 0);
411
                $tw = $w;
412
            } elseif ($this->logoAlign == 'R') {
413
                $nImgW = round($w / 3, 0);
414
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
415
                $xImg = round($x + ($w - (1 + $nImgW)), 0);
416
                $yImg = round(($h - $nImgH) / 2, 0) + $y;
417
                $x1 = $x;
418
                $y1 = round($h / 3 + $y, 0);
419
                $tw = round(2 * $w / 3, 0);
420
            }
421
            $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...
422
        } else {
423
            $x1 = $x;
424
            $y1 = round($h / 3 + $y, 0);
425
            $tw = $w;
426
        }
427
        //Nome emitente
428
        $aFont = array(
429
            'font' => $this->fontePadrao,
430
            'size' => 9,
431
            'style' => 'B');
432
        $texto = $this->getTagValue($this->emit, "xNome");
433
        $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...
434
        //endereço
435
        $y1 = $y1 + 3;
436
        $aFont = array(
437
            'font' => $this->fontePadrao,
438
            'size' => 7,
439
            'style' => '');
440
        $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...
441
        $lgr = $this->getTagValue($this->enderEmit, "xLgr");
442
        $nro = $this->getTagValue($this->enderEmit, "nro");
443
        $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...
444
        $bairro = $this->getTagValue($this->enderEmit, "xBairro");
445
        $CEP = $this->getTagValue($this->enderEmit, "CEP");
446
        $CEP = $this->formatField($CEP, "#####-###");
447
        $mun = $this->getTagValue($this->enderEmit, "xMun");
448
        $UF = $this->getTagValue($this->enderEmit, "UF");
449
        $xPais = $this->getTagValue($this->enderEmit, "xPais");
450
        $texto = $lgr . "," . $nro . "\n" . $bairro . " - "
451
            . $CEP . " - " . $mun . " - " . $UF . " " . $xPais
452
            . "\n  Fone/Fax: " . $fone;
453
        $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...
454
        //CNPJ/CPF IE
455
        $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...
456
        $ie = $this->getTagValue($this->emit, "IE");
457
        $texto = 'CNPJ/CPF:  ' . $cpfCnpj . '     Insc.Estadual: ' . $ie;
458
        $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...
459
        //outra caixa
460
        $h1 = 17.5;
461
        $y1 = $y + $h + 1;
462
        $this->pdf->textBox($x, $y1, $w + 2, $h1);
463
        //TIPO DO CT-E
464
        $texto = 'TIPO DO CTE';
465
        $wa = 37;
466
        $aFont = array(
467
            'font' => $this->fontePadrao,
468
            'size' => 8,
469
            'style' => '');
470
        $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...
471
        $tpCTe = $this->getTagValue($this->ide, "tpCTe");
472
        //0 - CT-e Normal,1 - CT-e de Complemento de Valores,
473
        //2 - CT-e de Anulação de Valores,3 - CT-e Substituto
474
        switch ($tpCTe) {
475
            case '0':
476
                $texto = 'Normal';
477
                break;
478
            case '1':
479
                $texto = 'Complemento de Valores';
480
                break;
481
            case '2':
482
                $texto = 'Anulação de Valores';
483
                break;
484
            case '3':
485
                $texto = 'Substituto';
486
                break;
487
            default:
488
                $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...
489
        }
490
        $aFont = $this->formatNegrito;
491
        $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...
492
        //TIPO DO SERVIÇO
493
        $texto = 'TIPO DO SERVIÇO';
494
        $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...
495
        $aFont = array(
496
            'font' => $this->fontePadrao,
497
            'size' => 8,
498
            'style' => '');
499
        $this->pdf->textBox($x + $wa + 4.5, $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...
500
        $tpServ = $this->getTagValue($this->ide, "tpServ");
501
        //'6' => 'Transporte de Pessoas', '7' => 'Transporte de Valores', '8' => 'Transporte de Bagagem'
502
        switch ($tpServ) {
503
            case '6':
504
                $texto = 'Transporte de Pessoas';
505
                break;
506
            case '7':
507
                $texto = 'Transporte de Valores';
508
                break;
509
            case '8':
510
                $texto = 'Transporte de Bagagem';
511
                break;
512
            default:
513
                $texto = 'ERRO' . $tpServ;
514
        }
515
        $aFont = $this->formatNegrito;
516
        $this->pdf->textBox($x + $wa + 4.5, $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...
517
        $this->pdf->line($w * 0.5, $y1, $w * 0.5, $y1 + $h1);
518
        //TOMADOR DO SERVIÇO
519
        $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...
520
521
        //##################################################################
522
        //coluna direita
523
        $x += $w + 2;
524
        $w = round($maxW * 0.335);
525
        $w1 = $w;
526
        $h = 11;
527
        $this->pdf->textBox($x, $y, $w + 10, $h + 1);
528
        $texto = "DACTE OS";
529
        $aFont = array(
530
            'font' => $this->fontePadrao,
531
            'size' => 10,
532
            'style' => 'B');
533
        $this->pdf->textBox($x, $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...
534
        $aFont = array(
535
            'font' => $this->fontePadrao,
536
            'size' => 9,
537
            'style' => '');
538
        $texto = "Documento Auxiliar do Conhecimento\nde Transporte Eletrônico para Outros Serviços";
539
        $h = 10;
540
        $this->pdf->textBox($x, $y + 4, $w, $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...
541
        $x1 = $x + $w + 2;
542
        $w = round($maxW * 0.22, 0);
543
        $w2 = $w;
0 ignored issues
show
Unused Code introduced by
$w2 is not used, you could remove the assignment.

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

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

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

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

Loading history...
544
        $h = 11;
545
        $this->pdf->textBox($x1 + 8, $y, $w - 7.5, $h + 1);
546
        $texto = "MODAL";
547
        $aFont = array(
548
            'font' => $this->fontePadrao,
549
            'size' => 10,
550
            'style' => '');
551
        $this->pdf->textBox($x1, $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...
552
        switch ($this->modal) {
553
            case '1':
554
                $texto = 'Rodoviário';
555
                break;
556
            case '2':
557
                $texto = 'Aéreo';
558
                break;
559
            case '3':
560
                $texto = 'Aquaviário';
561
                break;
562
            case '4':
563
                $texto = 'Ferroviário';
564
                break;
565
            case '5':
566
                $texto = 'Dutoviário';
567
                break;
568
        }
569
        $aFont = array(
570
            'font' => $this->fontePadrao,
571
            'size' => 10,
572
            'style' => 'B');
573
        $this->pdf->textBox($x1, $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...
574
        //outra caixa
575
        $y += 12;
576
        $h = 9;
577
        $w = $w1 + 10;
578
        $this->pdf->textBox($x, $y, $w, $h + 1);
579
        //modelo
580
        $wa = 12;
581
        $xa = $x;
582
        $texto = 'MODELO';
583
        $aFont = array(
584
            'font' => $this->fontePadrao,
585
            'size' => 8,
586
            'style' => '');
587
        $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...
588
        $texto = $this->getTagValue($this->ide, "mod");
589
        $aFont = $this->formatNegrito;
590
        $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...
591
        $this->pdf->line($x + $wa, $y, $x + $wa, $y + $h + 1);
592
        //serie
593
        $xa += $wa;
594
        $texto = 'SÉRIE';
595
        $aFont = array(
596
            'font' => $this->fontePadrao,
597
            'size' => 8,
598
            'style' => '');
599
        $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...
600
        $texto = $this->getTagValue($this->ide, "serie");
601
        $aFont = $this->formatNegrito;
602
        $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...
603
        $this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1);
604
        //numero
605
        $xa += $wa;
606
        $wa = 20;
607
        $texto = 'NÚMERO';
608
        $aFont = array(
609
            'font' => $this->fontePadrao,
610
            'size' => 8,
611
            'style' => '');
612
        $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...
613
        $texto = $this->getTagValue($this->ide, "nCT");
614
        $aFont = $this->formatNegrito;
615
        $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...
616
        $this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1);
617
        //data  hora de emissão
618
        $xa += $wa;
619
        $wa = 35;
620
        $texto = 'DATA E HORA DE EMISSÃO';
621
        $aFont = array(
622
            'font' => $this->fontePadrao,
623
            'size' => 8,
624
            'style' => '');
625
        $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...
626
        $this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1);
627
        $texto = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
628
            date('d/m/Y H:i:s', $this->toTimestamp($this->getTagValue($this->ide, "dhEmi"))) : '';
629
        $aFont = $this->formatNegrito;
630
        $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...
631
        $this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h + 1);
632
        //outra caixa
633
        $y += $h + 1;
634
        $h = 23;
635
        $h1 = 14;
636
        //$this->pdf->textBox($x, $y, $w + 0.5, $h1);
637
        //CODIGO DE BARRAS
638
        $chave_acesso = str_replace('CTe', '', $this->infCte->getAttribute("Id"));
639
        $bW = 75;
640
        $bH = 10;
641
        //codigo de barras
642
        $this->pdf->setFillColor(0, 0, 0);
643
        $this->pdf->code128($x + 2, $y + 2, $chave_acesso, $bW, $bH);
644
        $this->pdf->line($xa + $wa, $y, $xa + $wa, $y + $h - 1);
645
        $this->pdf->textBox($x, $y + $h1, $w + 0.5, $h1 - 6);
646
        $texto = 'CHAVE DE ACESSO';
647
        $aFont = $this->formatPadrao;
648
        $this->pdf->textBox($x + 1, $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...
649
        $aFont = $this->formatNegrito;
650
        $texto = $this->formatField($chave_acesso, $this->formatoChave);
651
        $this->pdf->textBox($x + 1, $y + $h1 + 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...
652
        $this->pdf->textBox($x, $y + $h1 + 8, $w + 0.5, $h1 - 4.5);
653
        $texto = "Consulta de autenticidade no portal nacional do CT-e, ";
654
        $texto .= "no site da Sefaz Autorizadora, \r\n ou em http://www.cte.fazenda.gov.br";
655
        if ($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) {
656
            $texto = "";
657
            $this->pdf->setFillColor(0, 0, 0);
658
            if ($this->tpEmis == 5) {
659
                $chaveContingencia = $this->geraChaveAdicCont();
660
                $this->pdf->code128($x + 20, $y1 + 10, $chaveContingencia, $bW * .9, $bH / 2);
661
            } else {
662
                $chaveContingencia = $this->getTagValue($this->protCTe, "nProt");
663
                $this->pdf->code128($x + 40, $y1 + 10, $chaveContingencia, $bW * .4, $bH / 2);
664
            }
665
            //codigo de barras
666
        }
667
        $aFont = array(
668
            'font' => $this->fontePadrao,
669
            'size' => 8,
670
            'style' => '');
671
        $this->pdf->textBox($x, $y + $h1 + 9, $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...
672
        //outra caixa
673
        $y += $h + 1;
674
        $h = 8.5;
675
        $wa = $w;
676
        $this->pdf->textBox($x, $y + 7.5, $w + 0.5, $h);
677
        if (!empty($this->numdepec)) {
678
            $texto = 'NÚMERO DE REGISTRO DPEC';
679
        } elseif ($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) {
680
            $texto = "DADOS DO CT-E";
681
        } else {
682
            $texto = 'PROTOCOLO DE AUTORIZAÇÃO DE USO';
683
        }
684
        $aFont = $this->formatPadrao;
685
        $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...
686
        if (!empty($this->numdepec)) {
687
            $texto = $this->numdepec;
688
        } elseif ($this->tpEmis == 5) {
689
            $chaveContingencia = $this->geraChaveAdicCont();
690
            $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...
691
                'font' => $this->fontePadrao,
692
                'size' => 8,
693
                'style' => 'B');
694
            $texto = $this->formatField($chaveContingencia, "#### #### #### #### #### #### #### #### ####");
695
            $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...
696
        } else {
697
            $texto = $this->getTagValue($this->protCTe, "nProt") . " - ";
698
            // empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue)
699
            if (!empty($this->protCTe)
700
                && !empty($this->protCTe->getElementsByTagName("dhRecbto")->item(0)->nodeValue)
701
            ) {
702
                $texto .= date(
703
                    'd/m/Y   H:i:s',
704
                    $this->toTimestamp($this->getTagValue($this->protCTe, "dhRecbto"))
705
                );
706
            }
707
            $texto = $this->getTagValue($this->protCTe, "nProt") == '' ? '' : $texto;
708
        }
709
        $aFont = $this->formatNegrito;
710
        $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...
711
712
        if ($this->qrCodMDFe !== null) {
713
            $this->qrCodeDacteOs($y-25);
714
            $w = 38;
715
            $x += 79;
716
            $this->pdf->textBox($x, $y - 34, $w + 0.5, $h + 41.5);
717
        }
718
        //CFOP
719
        $x = $oldX;
720
        $h = 8.5;
721
        $w = round($maxW * 0.42);
722
        $y1 = $y + 7.5;
723
        $this->pdf->textBox($x, $y1, $w + 2, $h);
724
        $texto = 'CFOP - NATUREZA DA PRESTAÇÃO';
725
        $aFont = array(
726
            'font' => $this->fontePadrao,
727
            'size' => 8,
728
            'style' => '');
729
        $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...
730
        $texto = $this->getTagValue($this->ide, "CFOP") . ' - ' . $this->getTagValue($this->ide, "natOp");
731
        $aFont = $this->formatNegrito;
732
        $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...
733
        //ORIGEM DA PRESTAÇÃO
734
        $y += $h + 7.5;
735
        $x = $oldX;
736
        $h = 8;
737
        $w = ($maxW * 0.33);
738
        $this->pdf->textBox($x, $y, $w + 0.5, $h);
739
        $texto = 'INÍCIO DA PRESTAÇÃO';
740
        $aFont = array(
741
            'font' => $this->fontePadrao,
742
            'size' => 8,
743
            'style' => '');
744
        $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...
745
        $texto = $this->getTagValue($this->ide, "xMunIni") . ' - ' . $this->getTagValue($this->ide, "UFIni");
746
        $aFont = $this->formatNegrito;
747
        $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...
748
        //PERCURSO DO VEÍCULO
749
        $x = $oldX + 69;
750
        $oldX = $x;
751
        $h = 8;
752
        $w = ($maxW * 0.334);
753
        $this->pdf->textBox($x, $y, $w + 0.5, $h);
754
        $texto = 'PERCURSO DO VEÍCULO';
755
        $aFont = array(
756
            'font' => $this->fontePadrao,
757
            'size' => 8,
758
            'style' => '');
759
        $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...
760
        $texto = '';
761
        $first = true;
762
        if (!empty($this->infPercurso)) {
763
            foreach ($this->infPercurso as $k => $d) {
764
                if (!$first) {
765
                    $texto .= ' - ';
766
                } else {
767
                    $first = false;
768
                }
769
                $texto .= $this->infPercurso->item($k)->getElementsByTagName('UFPer')->item(0)->nodeValue;
770
            }
771
        }
772
        $aFont = $this->formatNegrito;
773
        $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...
774
        //DESTINO DA PRESTAÇÃO
775
        $x = $oldX + $w + 1;
776
        $h = 8;
777
        $w = $w - 1.3;
778
        $this->pdf->textBox($x - 0.5, $y, $w + 0.5, $h);
779
        $texto = 'TÉRMINO DA PRESTAÇÃO';
780
        $aFont = array(
781
            'font' => $this->fontePadrao,
782
            'size' => 8,
783
            'style' => '');
784
        $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...
785
        $texto = $this->getTagValue($this->ide, "xMunFim") . ' - ' . $this->getTagValue($this->ide, "UFFim");
786
        $aFont = $this->formatNegrito;
787
        $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...
788
        //#########################################################################
789
        //Indicação de CTe Homologação, cancelamento e falta de protocolo
790
        $resp = $this->statusCTe();
791
        if (!$resp['status']) {
792
            $n = count($resp['message']);
793
            $alttot = $n * 15;
794
            $x = 10;
795
            $y = $this->hPrint/2 - $alttot/2;
796
            $h = 15;
797
            $w = $maxW - (2 * $x);
798
            $this->pdf->settextcolor(90, 90, 90);
799
            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...
800
                $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
801
                $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...
802
                $y += $h;
803
            }
804
            $texto = $resp['submessage'];
805
            if (!empty($texto)) {
806
                $y += 3;
807
                $h = 5;
808
                $aFont = ['font' => $this->fontePadrao, 'size' => 20, 'style' => 'B'];
809
                $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...
810
                $y += $h;
811
            }
812
            $y += 5;
813
            $w = $maxW - (2 * $x);
814
            $texto = "SEM VALOR FISCAL";
815
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
816
            $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...
817
            $this->pdf->settextcolor(0, 0, 0);
818
        }
819
        return $oldY;
820
    }
821
822
    /**
823
     * Verifica o status da CTe
824
     *
825
     * @return array
826
     */
827
    protected function statusCTe()
828
    {
829
        $resp = [
830
            'status' => true,
831
            'message' => [],
832
            'submessage' => ''
833
        ];
834
        if (!isset($this->cteProc)) {
835
            $resp['status'] = false;
836
            $resp['message'][] = 'CTe NÃO PROTOCOLADO';
837
        } elseif ($this->getTagValue($this->ide, "tpAmb") == '2') {
838
            $resp['status'] = false;
839
            $resp['message'][] =  "CTe EMITIDO EM HOMOLOGAÇÃO";
840
        }
841
        $retEvento = $this->cteProc->getElementsByTagName('retEventoCTe')->item(0);
842
        $cStat = $this->getTagValue($this->cteProc, "cStat");
843
        if ($cStat == '110' ||
844
            $cStat == '301' ||
845
            $cStat == '302'
846
        ) {
847
            $resp['status'] = false;
848
            $resp['message'][] = "CTe DENEGADO";
849
        } elseif ($cStat == '101'
850
            || $cStat == '151'
851
            || $cStat == '135'
852
            || $cStat == '155'
853
            || $this->cancelFlag === true
854
        ) {
855
            $resp['status'] = false;
856
            $resp['message'][] = "CTe CANCELADO";
857
        } elseif (!empty($retEvento)) {
858
            $infEvento = $retEvento->getElementsByTagName('infEvento')->item(0);
859
            $cStat = $this->getTagValue($infEvento, "cStat");
860
            $tpEvento= $this->getTagValue($infEvento, "tpEvento");
861
            $dhEvento = date("d/m/Y H:i:s", $this->toTimestamp($this->getTagValue($infEvento, "dhRegEvento")));
862
            $nProt = $this->getTagValue($infEvento, "nProt");
863
            if ($tpEvento == '110111' && ($cStat == '101' || $cStat == '151' || $cStat == '135' || $cStat == '155')) {
864
                $resp['status'] = false;
865
                $resp['message'][] = "CTe CANCELADO";
866
                $resp['submessage'] = "{$dhEvento} - {$nProt}";
867
            }
868
        } elseif (($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) && !empty($this->numdepec)) {
869
            $resp['status'] = true;
870
            $resp['message'][] = "CTe Emitido em Contingência";
871
            $resp['message'][] = "devido à problemas técnicos";
872
        } elseif ($this->tpEmis == 4) {
873
            $resp['status'] = true;
874
            $resp['message'][] = "CTe impresso em contingência -";
875
            $resp['message'][] = "DPEC regularmente recebido pela Receita";
876
            $resp['message'][] = "Federal do Brasil";
877
        }
878
        return $resp;
879
    }
880
881
    /**
882
     * rodapeDACTE
883
     * Monta o rodape no final da DACTE ( retrato e paisagem )
884
     *
885
     * @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...
886
     * @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...
887
     */
888
    protected function rodape($x, $y)
889
    {
890
        $texto = "Impresso em  " . date('d/m/Y   H:i:s') . ' ' .  $this->creditos;
891
        $w = $this->wPrint - 4;
892
        $aFont = array(
893
            'font' => $this->fontePadrao,
894
            'size' => 6,
895
            'style' => '');
896
        $this->pdf->textBox($x-1, $y+2, $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...
897
        $texto = $this->powered ? "Powered by NFePHP®" : '';
898
        $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
899
    }
900
901
    /**
902
     * tomador
903
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
904
     *
905
     * @param  number $x Posição horizontal canto esquerdo
906
     * @param  number $y Posição vertical canto superior
907
     * @return number Posição vertical final
908
     */
909
    protected function tomador($x = 0, $y = 0)
910
    {
911
        $oldX = $x;
912
        $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...
913
        if ($this->orientacao == 'P') {
914
            $maxW = $this->wPrint;
915
        } else {
916
            $maxW = $this->wPrint - $this->wCanhoto;
917
        }
918
        $w = $maxW;
919
        $h = 10;
920
        $texto = 'TOMADOR DO SERVIÇO';
921
        $aFont = $this->formatPadrao;
922
        $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...
923
        $aFont = $this->formatNegrito;
924
        $texto = $this->getTagValue($this->toma, "xNome");
925
        $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...
926
        $x = $maxW * 0.60;
927
        $texto = 'MUNICÍPIO';
928
        $aFont = $this->formatPadrao;
929
        $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...
930
        $texto = $this->getTagValue($this->toma, "xMun");
931
        $aFont = $this->formatNegrito;
932
        $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...
933
        $x = $maxW * 0.85;
934
        $texto = 'UF';
935
        $aFont = $this->formatPadrao;
936
        $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...
937
        $texto = $this->getTagValue($this->toma, "UF");
938
        $aFont = $this->formatNegrito;
939
        $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...
940
        $x = $w - 18;
941
        $texto = 'CEP';
942
        $aFont = $this->formatPadrao;
943
        $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...
944
        $texto = $this->formatField($this->getTagValue($this->toma, "CEP"), "#####-###");
945
        $aFont = $this->formatNegrito;
946
        $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...
947
        $y += 3;
948
        $x = $oldX;
949
        $texto = 'ENDEREÇO';
950
        $aFont = $this->formatPadrao;
951
        $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...
952
        $aFont = $this->formatNegrito;
953
        $texto = $this->getTagValue($this->toma, "xLgr") . ',';
954
        $texto .= $this->getTagValue($this->toma, "nro");
955
        $texto .= ($this->getTagValue($this->toma, "xCpl") != "") ?
956
            ' - ' . $this->getTagValue($this->toma, "xCpl") : '';
957
        $texto .= ' - ' . $this->getTagValue($this->toma, "xBairro");
958
        $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...
959
        $y += 3;
960
        $texto = 'CNPJ/CPF';
961
        $aFont = $this->formatPadrao;
962
        $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...
963
        $texto = $this->formatCNPJCPF($this->toma);
964
        $aFont = $this->formatNegrito;
965
        $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...
966
        $x = $x + 65;
967
        $texto = 'INSCRIÇÃO ESTADUAL';
968
        $aFont = $this->formatPadrao;
969
        $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...
970
        $texto = $this->getTagValue($this->toma, "IE");
971
        $aFont = $this->formatNegrito;
972
        $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...
973
        $x = $w * 0.75;
974
        $texto = 'PAÍS';
975
        $aFont = $this->formatPadrao;
976
        $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...
977
        $texto = $this->getTagValue($this->toma, "xPais") != "" ?
978
            $this->getTagValue($this->toma, "xPais") : 'BRASIL';
979
        $aFont = $this->formatNegrito;
980
        $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...
981
        $x = $w - 27;
982
        $texto = 'FONE';
983
        $aFont = $this->formatPadrao;
984
        $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...
985
        $texto = $this->getTagValue($this->toma, "fone")!=""? $this->formatFone($this->toma):'';
986
        $aFont = $this->formatNegrito;
987
        $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...
988
    }
989
990
    /**
991
     * compValorServ
992
     * Monta o campo com os componentes da prestação de serviços.
993
     *
994
     * @param  number $x Posição horizontal canto esquerdo
995
     * @param  number $y Posição vertical canto superior
996
     * @return number Posição vertical final
997
     */
998
    protected function compValorServ($x = 0, $y = 0)
999
    {
1000
        $oldX = $x;
1001
        $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...
1002
        if ($this->orientacao == 'P') {
1003
            $maxW = $this->wPrint;
1004
        } else {
1005
            $maxW = $this->wPrint - $this->wCanhoto;
1006
        }
1007
        $w = $maxW;
1008
        $h = 25;
1009
        $texto = 'COMPONENTES DO VALOR DA PRESTAÇÃO DO SERVIÇO';
1010
        $aFont = $this->formatPadrao;
1011
        $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...
1012
        $y += 3.4;
1013
        $this->pdf->line($x, $y, $w + 1, $y);
1014
        $texto = 'NOME';
1015
        $aFont = $this->formatPadrao;
1016
        $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...
1017
        $yIniDados = $y;
1018
        $x = $w * 0.14;
1019
        $texto = 'VALOR';
1020
        $aFont = $this->formatPadrao;
1021
        $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...
1022
        $x = $w * 0.28;
1023
        $this->pdf->line($x, $y, $x, $y + 21.5);
1024
        $texto = 'NOME';
1025
        $aFont = $this->formatPadrao;
1026
        $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...
1027
        $x = $w * 0.42;
1028
        $texto = 'VALOR';
1029
        $aFont = $this->formatPadrao;
1030
        $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...
1031
        $x = $w * 0.56;
1032
        $this->pdf->line($x, $y, $x, $y + 21.5);
1033
        $texto = 'NOME';
1034
        $aFont = $this->formatPadrao;
1035
        $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...
1036
        $x = $w * 0.70;
1037
        $texto = 'VALOR';
1038
        $aFont = $this->formatPadrao;
1039
        $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...
1040
        $x = $w * 0.86;
1041
        $this->pdf->line($x, $y, $x, $y + 21.5);
1042
        $y += 1;
1043
        $texto = 'VALOR TOTAL DO SERVIÇO';
1044
        $aFont = $this->formatPadrao;
1045
        $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...
1046
        $texto = number_format($this->getTagValue($this->vPrest, "vTPrest"), 2, ",", ".");
1047
        $aFont = array(
1048
            'font' => $this->fontePadrao,
1049
            'size' => 9,
1050
            'style' => 'B');
1051
        $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...
1052
        $y += 10;
1053
        $this->pdf->line($x, $y, $w + 1, $y);
1054
        $y += 1;
1055
        $texto = 'VALOR A RECEBER';
1056
        $aFont = $this->formatPadrao;
1057
        $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...
1058
        $texto = number_format($this->getTagValue($this->vPrest, "vRec"), 2, ",", ".");
1059
        $aFont = array(
1060
            'font' => $this->fontePadrao,
1061
            'size' => 9,
1062
            'style' => 'B');
1063
        $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...
1064
        $auxX = $oldX;
1065
        $yIniDados += 4;
1066
1067
        foreach ($this->Comp as $k => $d) {
1068
            $nome = $this->Comp->item($k)->getElementsByTagName('xNome')->item(0)->nodeValue;
1069
            $valor = number_format(
1070
                $this->Comp->item($k)->getElementsByTagName('vComp')->item(0)->nodeValue,
1071
                2,
1072
                ",",
1073
                "."
1074
            );
1075
            if ($auxX > $w * 0.60) {
1076
                $yIniDados = $yIniDados + 4;
1077
                $auxX = $oldX;
1078
            }
1079
            $texto = $nome;
1080
            $aFont = $this->formatPadrao;
1081
            $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...
1082
            $auxX += $w * 0.14;
1083
            $texto = $valor;
1084
            $aFont = $this->formatPadrao;
1085
            $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...
1086
            $auxX += $w * 0.14;
1087
        }
1088
    } //fim da função compValorDACTE
1089
1090
    /**
1091
     * impostos
1092
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1093
     *
1094
     * @param  number $x Posição horizontal canto esquerdo
1095
     * @param  number $y Posição vertical canto superior
1096
     * @return number Posição vertical final
1097
     */
1098
    protected function impostos($x = 0, $y = 0)
1099
    {
1100
        $oldX = $x;
1101
        $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...
1102
        if ($this->orientacao == 'P') {
1103
            $maxW = $this->wPrint;
1104
        } else {
1105
            $maxW = $this->wPrint - $this->wCanhoto;
1106
        }
1107
        $w = $maxW;
1108
        $h = 13;
1109
        $texto = 'INFORMAÇÕES RELATIVAS AO IMPOSTO';
1110
        $aFont = $this->formatPadrao;
1111
        $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...
1112
1113
        $y += 3.4;
1114
        $this->pdf->line($x, $y, $w + 1, $y);
1115
        $texto = 'SITUAÇÃO TRIBUTÁRIA';
1116
        $aFont = $this->formatPadrao;
1117
        $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...
1118
1119
        $x += $w * 0.26;
1120
        $this->pdf->line($x, $y, $x, $y + 9.5);
1121
        $texto = 'BASE DE CALCULO';
1122
        $aFont = $this->formatPadrao;
1123
        $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...
1124
1125
        $wCol02=0.18;
1126
        $x += $w * $wCol02;
1127
        $this->pdf->line($x, $y, $x, $y + 9.5);
1128
        $texto = 'ALÍQ ICMS';
1129
        $aFont = $this->formatPadrao;
1130
        $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...
1131
1132
        $x += $w * $wCol02;
1133
        $this->pdf->line($x, $y, $x, $y + 9.5);
1134
        $texto = 'VALOR ICMS';
1135
        $aFont = $this->formatPadrao;
1136
        $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...
1137
1138
        $x += $w * $wCol02;
1139
        $this->pdf->line($x, $y, $x, $y + 9.5);
1140
        $texto = '% RED. BC ICMS';
1141
        $aFont = $this->formatPadrao;
1142
        $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...
1143
1144
        /*$x += $w * 0.14;
1145
        $this->pdf->line($x, $y, $x, $y + 9.5);
1146
        $texto = 'ICMS ST';
1147
        $aFont = $this->formatPadrao;
1148
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1149
         * */
1150
1151
        $x = $oldX;
1152
        $y = $y + 4;
1153
        $texto = $this->getTagValue($this->ICMS, "CST");
1154
        switch ($texto) {
1155
            case '00':
1156
                $texto = "00 - Tributação normal ICMS";
1157
                break;
1158
            case '20':
1159
                $texto = "20 - Tributação com BC reduzida do ICMS";
1160
                break;
1161
            case '40':
1162
                $texto = "40 - ICMS isenção";
1163
                break;
1164
            case '41':
1165
                $texto = "41 - ICMS não tributada";
1166
                break;
1167
            case '51':
1168
                $texto = "51 - ICMS diferido";
1169
                break;
1170
            case '60':
1171
                $texto = "60 - ICMS cobrado anteriormente por substituição tributária";
1172
                break;
1173
            case '90':
1174
                $texto = "90 - ICMS outros";
1175
                break;
1176
        }
1177
        $texto = $this->getTagValue($this->ICMSSN, "indSN") == 1 ? 'Simples Nacional' : $texto;
1178
        $aFont = $this->formatNegrito;
1179
        $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...
1180
        $x += $w * 0.26;
1181
1182
        $texto = !empty($this->ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
1183
            number_format($this->getTagValue($this->ICMS, "vBC"), 2, ",", ".") : '';
1184
        $aFont = $this->formatNegrito;
1185
        $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...
1186
        $x += $w * $wCol02;
1187
1188
        $texto = !empty($this->ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
1189
            number_format($this->getTagValue($this->ICMS, "pICMS"), 2, ",", ".") : '';
1190
        $aFont = $this->formatNegrito;
1191
        $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...
1192
        $x += $w * $wCol02;
1193
1194
        $texto = !empty($this->ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
1195
            number_format($this->getTagValue($this->ICMS, "vICMS"), 2, ",", ".") : '';
1196
        $aFont = $this->formatNegrito;
1197
        $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...
1198
        $x += $w * $wCol02;
1199
1200
        $texto = !empty($this->ICMS->getElementsByTagName("pRedBC")->item(0)->nodeValue) ?
1201
            number_format($this->getTagValue($this->ICMS, "pRedBC"), 2, ",", ".").'%' :'';
1202
        $aFont = $this->formatNegrito;
1203
        $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...
1204
1205
        /*$x += $w * 0.14;
1206
        $texto = '';
1207
        $aFont = $this->formatNegrito;
1208
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');*/
1209
    } //fim da função compValorDACTE
1210
1211
    /**
1212
     * geraChaveAdicCont
1213
     *
1214
     * @return string chave
1215
     */
1216
    protected function geraChaveAdicCont()
1217
    {
1218
        //cUF tpEmis CNPJ vNF ICMSp ICMSs DD  DV
1219
        // Quantidade de caracteres  02   01      14  14    01    01  02 01
1220
        $forma = "%02d%d%s%014d%01d%01d%02d";
1221
        $cUF = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue;
1222
        $CNPJ = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue;
1223
        $CNPJ = substr($CNPJ, -14);
1224
        $vCT = number_format($this->getTagValue($this->vPrest, "vRec"), 2, "", "") * 100;
1225
        $ICMS_CST = $this->getTagValue($this->ICMS, "CST");
1226
        switch ($ICMS_CST) {
1227
            case '00':
1228
            case '20':
1229
                $ICMSp = '1';
1230
                $ICMSs = '2';
1231
                break;
1232
            case '40':
1233
            case '41':
1234
            case '51':
1235
            case '90':
1236
                $ICMSp = '2';
1237
                $ICMSs = '2';
1238
                break;
1239
            case '60':
1240
                $ICMSp = '2';
1241
                $ICMSs = '1';
1242
                break;
1243
        }
1244
        $dd = $this->ide->getElementsByTagName('dEmi')->item(0)->nodeValue;
1245
        $rpos = strrpos($dd, '-');
1246
        $dd = substr($dd, $rpos + 1);
1247
        $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...
1248
        $chave = $chave . $this->pModulo11($chave);
0 ignored issues
show
Bug introduced by
The method pModulo11() does not exist on NFePHP\DA\CTe\DacteOS. Did you maybe mean modulo11()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
1249
        return $chave;
1250
    } //fim geraChaveAdicCont
1251
1252
    /**
1253
     * infPrestacaoServico
1254
     * Monta o campo com das informações da prestação do serviço
1255
     *
1256
     * @param  number $x Posição horizontal canto esquerdo
1257
     * @param  number $y Posição vertical canto superior
1258
     * @return number Posição vertical final
1259
     */
1260
    protected function infPrestacaoServico($x = 0, $y = 0)
1261
    {
1262
        $oldX = $x;
1263
        $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...
1264
        if ($this->orientacao == 'P') {
1265
            $maxW = $this->wPrint;
1266
        } else {
1267
            $maxW = $this->wPrint - $this->wCanhoto;
1268
        }
1269
        $w = $maxW;
1270
1271
        // SE FOR RODOVIARIO ( BTR-SEMPRE SERÁ )
1272
        if ($this->modal == '1') {
1273
            // 0 - Não; 1 - Sim Será lotação quando houver um único conhecimento de transporte por veículo,
1274
            // ou combinação veicular, e por viagem
1275
            $h = $this->lota == 1 ? 35 : 53;
1276
        } elseif ($this->modal == '3') {
1277
            $h = 37.6;
1278
        } else {
1279
            $h = 35;
1280
        }
1281
        $texto = 'INFORMAÇÕES DA PRESTAÇÃO DO SERVIÇO';
1282
        $aFont = $this->formatPadrao;
1283
        $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...
1284
        $descr1 = 'QUANTIDADE';
1285
        $descr2 = 'DESCRIÇÃO DO SERVIÇO PRESTADO';
1286
1287
        $y += 3.4;
1288
        $this->pdf->line($x, $y, $w + 1, $y); // LINHA ABAIXO DO TEXTO: "DOCUMENTOS ORIGINÁRIOS
1289
        $texto = $descr1;
1290
        $aFont = $this->formatPadrao;
1291
        $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...
1292
        $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...
1293
1294
        $x += $w * 0.14;
1295
        if ($this->modal == '1') {
1296
            if ($this->lota == 1) {
1297
                $this->pdf->line($x, $y, $x, $y + 31.5); // TESTE
1298
            } else {
1299
                $this->pdf->line($x, $y, $x, $y + 49.5); // TESTE
1300
            }
1301
        } elseif ($this->modal == '3') {
1302
            $this->pdf->line($x, $y, $x, $y + 34.1);
1303
        } else {
1304
            $this->pdf->line($x, $y, $x, $y + 21.5);
1305
        }
1306
1307
        $x += $w * 0.08;
1308
        $texto = $descr2;
1309
        $aFont = $this->formatPadrao;
1310
        $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...
1311
1312
        //$auxX = $oldX;
1313
        //$yIniDados += 3;
1314
1315
        $x = $oldX;
1316
        $y = $y + 4;
1317
        $texto = number_format($this->getTagValue($this->infQ->item(0), "qCarga"), 3, ",", ".");
1318
        $aFont = $this->formatNegrito;
1319
        $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...
1320
        $x += $w * 0.26;
1321
1322
        $x = $oldX + 35;
1323
        $texto = $this->getTagValue($this->infServico->item(0), "xDescServ");
1324
        $aFont = $this->formatNegrito;
1325
        $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...
1326
        $x += $w * 0.26;
1327
1328
1329
        $r = $this->cabecalho(1, 1, '1', $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...
1330
        $contador = 0;
0 ignored issues
show
Unused Code introduced by
$contador 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...
1331
    }
1332
1333
    /**
1334
     * docCompl
1335
     * Monta o campo com os dados do remetente na DACTE.
1336
     *
1337
     * @param number $x Posição horizontal canto esquerdo
1338
     * @param number $y Posição vertical canto superior
1339
     * @return number Posição vertical final
1340
     */
1341
    protected function docCompl($x = 0, $y = 0)
1342
    {
1343
        $oldX = $x;
1344
        $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...
1345
        if ($this->orientacao == 'P') {
1346
            $maxW = $this->wPrint;
1347
        } else {
1348
            $maxW = $this->wPrint - $this->wCanhoto;
1349
        }
1350
        $w = $maxW;
1351
        $h = 80;
1352
        $texto = 'DETALHAMENTO DO CT-E COMPLEMENTADO';
1353
        $aFont = $this->formatPadrao;
1354
        $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...
1355
        $descr1 = 'CHAVE DO CT-E COMPLEMENTADO';
1356
        $descr2 = 'VALOR COMPLEMENTADO';
1357
        $y += 3.4;
1358
        $this->pdf->line($x, $y, $w + 1, $y);
1359
        $texto = $descr1;
1360
        $aFont = $this->formatPadrao;
1361
        $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...
1362
        $yIniDados = $y;
1363
        $x += $w * 0.37;
1364
        $texto = $descr2;
1365
        $aFont = $this->formatPadrao;
1366
        $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...
1367
        $x += $w * 0.13;
1368
        $this->pdf->line($x, $y, $x, $y + 76.5);
1369
        $texto = $descr1;
1370
        $aFont = $this->formatPadrao;
1371
        $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...
1372
        $x += $w * 0.3;
1373
        $texto = $descr2;
1374
        $aFont = $this->formatPadrao;
1375
        $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...
1376
        $auxX = $oldX;
1377
        $yIniDados += 4;
1378
        if ($auxX > $w * 0.90) {
1379
            $yIniDados = $yIniDados + 4;
1380
            $auxX = $oldX;
1381
        }
1382
        $texto = $this->chaveCTeRef;
1383
        $aFont = array(
1384
            'font' => $this->fontePadrao,
1385
            'size' => 8,
1386
            'style' => '');
1387
        $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...
1388
        $texto = number_format($this->getTagValue($this->vPrest, "vTPrest"), 2, ",", ".");
1389
        $aFont = array(
1390
            'font' => $this->fontePadrao,
1391
            'size' => 8,
1392
            'style' => '');
1393
        $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...
1394
    }
1395
1396
    /**
1397
     * observacoes
1398
     * Monta o campo com os dados do remetente na DACTE.
1399
     *
1400
     * @param  number $x Posição horizontal canto esquerdo
1401
     * @param  number $y Posição vertical canto superior
1402
     * @return number Posição vertical final
1403
     */
1404
    protected function observacoes($x = 0, $y = 0)
1405
    {
1406
        $oldX = $x;
1407
        $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...
1408
        if ($this->orientacao == 'P') {
1409
            $maxW = $this->wPrint;
1410
        } else {
1411
            $maxW = $this->wPrint - $this->wCanhoto;
1412
        }
1413
        $w = $maxW;
1414
        //$h = 18;
1415
        $h = 18.8;
1416
        $texto = 'OBSERVAÇÕES GERAIS';
1417
        $aFont = $this->formatPadrao;
1418
        $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...
1419
        $y += 3.4;
1420
        $this->pdf->line($x, $y, $w + 1, $y);
1421
        $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...
1422
        $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...
1423
        $texto = '';
1424
        foreach ($this->compl as $k => $d) {
1425
            $xObs = $this->getTagValue($this->compl->item($k), "xObs");
1426
            $texto .= $xObs;
1427
        }
1428
        $textoObs = explode("Motorista:", $texto);
1429
        $textoObs[1] = isset($textoObs[1]) ? "Motorista: ".$textoObs[1]: '';
1430
        $texto .= $this->getTagValue($this->imp, "infAdFisco", "\r\n");
1431
        $aFont = array(
1432
            'font' => $this->fontePadrao,
1433
            'size' => 7.5,
1434
            'style' => '');
1435
        $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...
1436
        $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...
1437
    }
1438
1439
    /**
1440
     * seguro
1441
     * Monta o campo com os dados de seguro do CT-e OS.
1442
     *
1443
     * @param  number $x Posição horizontal canto esquerdo
1444
     * @param  number $y Posição vertical canto superior
1445
     * @return number Posição vertical final
1446
     */
1447
    protected function seguro($x = 0, $y = 0)
1448
    {
1449
        $oldX = $x;
1450
        $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...
1451
        if ($this->orientacao == 'P') {
1452
            $maxW = $this->wPrint;
1453
        } else {
1454
            $maxW = $this->wPrint - $this->wCanhoto;
1455
        }
1456
        $w = $maxW;
1457
        $h = 13;
1458
        $texto = 'SEGURO DA VIAGEM';
1459
        $aFont = $this->formatPadrao;
1460
        $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...
1461
1462
        $y += 3.4;
1463
        $this->pdf->line($x, $y, $w + 1, $y);
1464
        $texto = 'RESPONSÁVEL';
1465
        $aFont = $this->formatPadrao;
1466
        $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...
1467
1468
        $x += $w * 0.33;
1469
        $this->pdf->line($x, $y, $x, $y + 9.5);
1470
        $texto = 'NOME DA SEGURADORA';
1471
        $aFont = $this->formatPadrao;
1472
        $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...
1473
1474
        $wCol02=0.33;
1475
        $x += $w * $wCol02;
1476
        $this->pdf->line($x, $y, $x, $y + 9.5);
1477
        $texto = 'NÚMERO DA APÓLICE';
1478
        $aFont = $this->formatPadrao;
1479
        $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...
1480
1481
        $x = $oldX;
1482
        $y = $y + 4;
1483
        $texto = $this->respSeg;
1484
        $aFont = $this->formatNegrito;
1485
        $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...
1486
        $x += $w * 0.33;
1487
        $texto = $this->xSeg;
1488
1489
        $aFont = $this->formatNegrito;
1490
        $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...
1491
        $x += $w * 0.33;
1492
        $texto = $this->nApol;
1493
1494
        $aFont = $this->formatNegrito;
1495
        $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...
1496
    }
1497
1498
    /**
1499
     * modalRod
1500
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1501
     *
1502
     * @param  number $x Posição horizontal canto esquerdo
1503
     * @param  number $y Posição vertical canto superior
1504
     * @return number Posição vertical final
1505
     */
1506
    protected function modalRod($x = 0, $y = 0)
1507
    {
1508
        $oldX = $x;
1509
        $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...
1510
        if ($this->orientacao == 'P') {
1511
            $maxW = $this->wPrint;
1512
        } else {
1513
            $maxW = $this->wPrint - $this->wCanhoto;
1514
        }
1515
        $w = $maxW;
1516
        $h = 13;
1517
        $texto = 'DADOS ESPECÍFICOS DO MODAL RODOVIÁRIO';
1518
        $aFont = $this->formatPadrao;
1519
        $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...
1520
1521
        $y += 3.4;
1522
        $this->pdf->line($x, $y, $w + 1, $y);
1523
        $texto = 'TERMO DE AUTORIZAÇÃO DE FRETAMENTO';
1524
        $aFont = $this->formatPadrao;
1525
        $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...
1526
1527
        $x += $w * 0.26;
1528
        $this->pdf->line($x, $y, $x, $y + 9.5);
1529
        $texto = 'Nº DE REGISTRO ESTADUAL';
1530
        $aFont = $this->formatPadrao;
1531
        $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...
1532
1533
        $wCol02=0.18;
1534
        $x += $w * $wCol02;
1535
        $this->pdf->line($x, $y, $x, $y + 9.5);
1536
        $texto = 'PLACA DO VEÍCULO';
1537
        $aFont = $this->formatPadrao;
1538
        $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...
1539
1540
        $x += $w * $wCol02;
1541
        $this->pdf->line($x, $y, $x, $y + 9.5);
1542
        $texto = 'RENAVAM DO VEÍCULO';
1543
        $aFont = $this->formatPadrao;
1544
        $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...
1545
1546
        $x += $w * $wCol02;
1547
        $this->pdf->line($x, $y, $x, $y + 9.5);
1548
        $texto = 'CNPJ/CPF';
1549
        $aFont = $this->formatPadrao;
1550
        $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...
1551
1552
        $x = $oldX;
1553
        $y = $y + 4;
1554
        $texto = $this->getTagValue($this->rodo, "TAF");
1555
        $aFont = $this->formatNegrito;
1556
        $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...
1557
        $x += $w * 0.26;
1558
1559
        $texto = $this->getTagValue($this->rodo, "NroRegEstadual");
1560
        $aFont = $this->formatNegrito;
1561
        $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...
1562
        $x += $w * $wCol02;
1563
1564
        $texto = $this->getTagValue($this->veic->item(0), "placa");
1565
        $aFont = $this->formatNegrito;
1566
        $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...
1567
        $x += $w * $wCol02;
1568
1569
        $texto = $this->getTagValue($this->veic->item(0), "RENAVAM");
1570
        $aFont = $this->formatNegrito;
1571
        $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...
1572
        $x += $w * $wCol02;
1573
1574
        $texto = !empty($this->getTagValue($this->veic->item(0), "CPF")) ?
1575
            $this->getTagValue($this->veic->item(0), "CPF") :
1576
            (!empty($this->getTagValue($this->veic->item(0), "CNPJ")) ?
1577
            $this->getTagValue($this->veic->item(0), "CNPJ") : '');
1578
        $aFont = $this->formatNegrito;
1579
        $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...
1580
1581
        /*$x += $w * 0.14;
1582
        $texto = '';
1583
        $aFont = $this->formatNegrito;
1584
        $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');*/
1585
    }
1586
1587
    /**
1588
     * modalAquaviario
1589
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1590
     *
1591
     * @param  number $x Posição horizontal canto esquerdo
1592
     * @param  number $y Posição vertical canto superior
1593
     * @return number Posição vertical final
1594
     */
1595
    protected function modalAquaviario($x = 0, $y = 0)
1596
    {
1597
        $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...
1598
        $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...
1599
        if ($this->orientacao == 'P') {
1600
            $maxW = $this->wPrint;
1601
        } else {
1602
            $maxW = $this->wPrint - $this->wCanhoto;
1603
        }
1604
        $w = $maxW;
1605
        $h = 8.5;
1606
        $texto = 'DADOS ESPECÍFICOS DO MODAL AQUAVIÁRIO';
1607
        $aFont = $this->formatPadrao;
1608
        $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...
1609
        $y += 3.4;
1610
        $this->pdf->line($x, $y, $w + 1, $y);
1611
        $texto = 'PORTO DE EMBARQUE';
1612
        $aFont = $this->formatPadrao;
1613
        $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...
1614
        $texto = $this->getTagValue($this->aquav, "prtEmb");
1615
        $aFont = $this->formatNegrito;
1616
        $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...
1617
        $x += $w * 0.50;
1618
        $this->pdf->line($x, $y, $x, $y + 7.7);
1619
        $texto = 'PORTO DE DESTINO';
1620
        $aFont = $this->formatPadrao;
1621
        $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...
1622
        $texto = $this->getTagValue($this->aquav, "prtDest");
1623
        $aFont = $this->formatNegrito;
1624
        $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...
1625
        $y += 8;
1626
        $this->pdf->line(208, $y, 1, $y);
1627
        $x = 1;
1628
        $texto = 'IDENTIFICAÇÃO DO NAVIO / REBOCADOR';
1629
        $aFont = $this->formatPadrao;
1630
        $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...
1631
        $texto = $this->getTagValue($this->aquav, "xNavio");
1632
        $aFont = $this->formatNegrito;
1633
        $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...
1634
        $x += $w * 0.50;
1635
        $this->pdf->line($x, $y, $x, $y + 7.7);
1636
        $texto = 'VR DA B. DE CALC. AFRMM';
1637
        $aFont = $this->formatPadrao;
1638
        $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...
1639
        $texto = $this->getTagValue($this->aquav, "vPrest");
1640
        $aFont = $this->formatNegrito;
1641
        $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...
1642
        $x += $w * 0.17;
1643
        $this->pdf->line($x, $y, $x, $y + 7.7);
1644
        $texto = 'VALOR DO AFRMM';
1645
        $aFont = $this->formatPadrao;
1646
        $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...
1647
        $texto = $this->getTagValue($this->aquav, "vAFRMM");
1648
        $aFont = $this->formatNegrito;
1649
        $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...
1650
        $x += $w * 0.12;
1651
        $this->pdf->line($x, $y, $x, $y + 7.7);
1652
        $texto = 'TIPO DE NAVEGAÇÃO';
1653
        $aFont = $this->formatPadrao;
1654
        $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...
1655
        $texto = $this->getTagValue($this->aquav, "tpNav");
1656
        switch ($texto) {
1657
            case '0':
1658
                $texto = 'INTERIOR';
1659
                break;
1660
            case '1':
1661
                $texto = 'CABOTAGEM';
1662
                break;
1663
        }
1664
        $aFont = $this->formatNegrito;
1665
        $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...
1666
        $x += $w * 0.14;
1667
        $this->pdf->line($x, $y, $x, $y + 7.7);
1668
        $texto = 'DIREÇÃO';
1669
        $aFont = $this->formatPadrao;
1670
        $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...
1671
        $texto = $this->getTagValue($this->aquav, "direc");
1672
        switch ($texto) {
1673
            case 'N':
1674
                $texto = 'NORTE';
1675
                break;
1676
            case 'L':
1677
                $texto = 'LESTE';
1678
                break;
1679
            case 'S':
1680
                $texto = 'SUL';
1681
                break;
1682
            case 'O':
1683
                $texto = 'OESTE';
1684
                break;
1685
        }
1686
        $aFont = $this->formatNegrito;
1687
        $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...
1688
        $y += 8;
1689
        $this->pdf->line(208, $y, 1, $y);
1690
        $x = 1;
1691
        $texto = 'IDENTIFICAÇÃO DOS CONTEINERS';
1692
        $aFont = $this->formatPadrao;
1693
        $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...
1694
        if ($this->infNF->item(0) !== null && $this->infNF->item(0)->getElementsByTagName('infUnidCarga') !== null) {
1695
            $texto = $this->infNF
1696
                ->item(0)
1697
                ->getElementsByTagName('infUnidCarga')
1698
                ->item(0)
1699
                ->getElementsByTagName('idUnidCarga')
1700
                ->item(0)->nodeValue;
1701
        } elseif ($this->infNFe->item(0) !== null
1702
            && $this->infNFe->item(0)->getElementsByTagName('infUnidCarga') !== null
1703
        ) {
1704
            $texto = $this->infNFe
1705
                ->item(0)
1706
                ->getElementsByTagName('infUnidCarga')
1707
                ->item(0)
1708
                ->getElementsByTagName('idUnidCarga')
1709
                ->item(0)
1710
                ->nodeValue;
1711
        } elseif ($this->infOutros->item(0) !== null
1712
            && $this->infOutros->item(0)->getElementsByTagName('infUnidCarga') !== null
1713
        ) {
1714
            $texto = $this->infOutros
1715
                ->item(0)
1716
                ->getElementsByTagName('infUnidCarga')
1717
                ->item(0)
1718
                ->getElementsByTagName('idUnidCarga')
1719
                ->item(0)
1720
                ->nodeValue;
1721
        } else {
1722
            $texto = '';
1723
        }
1724
        $aFont = $this->formatNegrito;
1725
        $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...
1726
        $x += $w * 0.50;
1727
        $this->pdf->line($x, $y, $x, $y + 7.7);
1728
        $texto = 'IDENTIFICAÇÃO DAS BALSAS';
1729
        $aFont = $this->formatPadrao;
1730
        $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...
1731
        $texto = '';
1732
        if ($this->getTagValue($this->aquav, "balsa") !== '') {
1733
            foreach ($this->aquav->getElementsByTagName('balsa') as $k => $d) {
1734
                if ($k == 0) {
1735
                    $texto = $this->aquav
1736
                        ->getElementsByTagName('balsa')
1737
                        ->item($k)
1738
                        ->getElementsByTagName('xBalsa')
1739
                        ->item(0)
1740
                        ->nodeValue;
1741
                } else {
1742
                    $texto = $texto
1743
                        . ' / '
1744
                        . $this->aquav
1745
                            ->getElementsByTagName('balsa')
1746
                            ->item($k)
1747
                            ->getElementsByTagName('xBalsa')
1748
                            ->item(0)
1749
                            ->nodeValue;
1750
                }
1751
            }
1752
        }
1753
        $aFont = $this->formatNegrito;
1754
        $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...
1755
    }
1756
1757
    /**
1758
     * modalFerr
1759
     * Monta o campo com os dados do remetente na DACTE. ( retrato  e paisagem  )
1760
     *
1761
     * @param  number $x Posição horizontal canto esquerdo
1762
     * @param  number $y Posição vertical canto superior
1763
     * @return number Posição vertical final
1764
     */
1765
    protected function modalFerr($x = 0, $y = 0)
1766
    {
1767
        $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...
1768
        $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...
1769
        if ($this->orientacao == 'P') {
1770
            $maxW = $this->wPrint;
1771
        } else {
1772
            $maxW = $this->wPrint - $this->wCanhoto;
1773
        }
1774
        $w = $maxW;
1775
        $h = 19.6;
1776
        $texto = 'DADOS ESPECÍFICOS DO MODAL FERROVIÁRIO';
1777
        $aFont = $this->formatPadrao;
1778
        $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...
1779
        $y += 3.4;
1780
        $this->pdf->line($x, $y, $w + 1, $y);
1781
        $texto = 'DCL';
1782
        $aFont = array(
1783
            'font' => $this->fontePadrao,
1784
            'size' => 7,
1785
            'style' => 'B');
1786
        $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...
1787
        $this->pdf->line($x + 49.6, $y, $x + 49.6, $y + 3.5);
1788
        $texto = 'VAGÕES';
1789
        $aFont = array(
1790
            'font' => $this->fontePadrao,
1791
            'size' => 7,
1792
            'style' => 'B');
1793
        $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...
1794
        $y += 3.4;
1795
        $this->pdf->line($x, $y, $w + 1, $y);
1796
        // DCL
1797
        $texto = 'ID TREM';
1798
        $aFont = array(
1799
            'font' => $this->fontePadrao,
1800
            'size' => 6,
1801
            'style' => '');
1802
        $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...
1803
        $texto = $this->getTagValue($this->ferrov, "idTrem");
1804
        $aFont = array(
1805
            'font' => $this->fontePadrao,
1806
            'size' => 6,
1807
            'style' => 'B');
1808
        $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...
1809
        $x += $w * 0.06;
1810
        $y1 = $y + 12.5;
1811
        $this->pdf->line($x, $y, $x, $y1);
1812
        $texto = 'NUM';
1813
        $aFont = array(
1814
            'font' => $this->fontePadrao,
1815
            'size' => 6,
1816
            'style' => '');
1817
        $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...
1818
        $texto = $this->getTagValue($this->rem, "nDoc");
0 ignored issues
show
Bug introduced by
The property rem 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...
1819
        $aFont = array(
1820
            'font' => $this->fontePadrao,
1821
            'size' => 6,
1822
            'style' => 'B');
1823
        $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...
1824
        $x += $w * 0.06;
1825
        $this->pdf->line($x, $y, $x, $y1);
1826
        $texto = 'SÉRIE';
1827
        $aFont = array(
1828
            'font' => $this->fontePadrao,
1829
            'size' => 6,
1830
            'style' => '');
1831
        $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...
1832
        $texto = $this->getTagValue($this->rem, "serie");
1833
        $aFont = array(
1834
            'font' => $this->fontePadrao,
1835
            'size' => 6,
1836
            'style' => 'B');
1837
        $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...
1838
        $x += $w * 0.06;
1839
        $this->pdf->line($x, $y, $x, $y1);
1840
        $texto = 'EMISSÃO';
1841
        $aFont = array(
1842
            'font' => $this->fontePadrao,
1843
            'size' => 6,
1844
            'style' => '');
1845
        $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...
1846
        $texto = $this->pYmd2dmy($this->getTagValue($this->rem, "dEmi"));
0 ignored issues
show
Bug introduced by
The method pYmd2dmy() does not seem to exist on object<NFePHP\DA\CTe\DacteOS>.

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...
1847
        $aFont = array(
1848
            'font' => $this->fontePadrao,
1849
            'size' => 6,
1850
            'style' => 'B');
1851
        $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...
1852
        // VAGOES
1853
        $x += $w * 0.06;
1854
        $this->pdf->line($x, $y, $x, $y1);
1855
        $texto = 'NUM';
1856
        $aFont = array(
1857
            'font' => $this->fontePadrao,
1858
            'size' => 6,
1859
            'style' => '');
1860
        $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...
1861
        $texto = $this->getTagValue($this->ferrov, "nVag");
1862
        $aFont = array(
1863
            'font' => $this->fontePadrao,
1864
            'size' => 6,
1865
            'style' => 'B');
1866
        $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...
1867
        $x += $w * 0.06;
1868
        $this->pdf->line($x, $y, $x, $y1);
1869
        $texto = 'TIPO';
1870
        $aFont = array(
1871
            'font' => $this->fontePadrao,
1872
            'size' => 6,
1873
            'style' => '');
1874
        $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...
1875
        $texto = $this->getTagValue($this->ferrov, "tpVag");
1876
        $aFont = array(
1877
            'font' => $this->fontePadrao,
1878
            'size' => 6,
1879
            'style' => 'B');
1880
        $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...
1881
        $x += $w * 0.06;
1882
        $this->pdf->line($x, $y, $x, $y1);
1883
        $texto = 'CAPACIDADE';
1884
        $aFont = array(
1885
            'font' => $this->fontePadrao,
1886
            'size' => 6,
1887
            'style' => '');
1888
        $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...
1889
        $texto = $this->getTagValue($this->ferrov, "cap");
1890
        $aFont = array(
1891
            'font' => $this->fontePadrao,
1892
            'size' => 6,
1893
            'style' => 'B');
1894
        $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...
1895
        $x += $w * 0.08;
1896
        $this->pdf->line($x, $y, $x, $y1);
1897
        $texto = 'PESO REAL/TON';
1898
        $aFont = array(
1899
            'font' => $this->fontePadrao,
1900
            'size' => 6,
1901
            'style' => '');
1902
        $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...
1903
        $texto = $this->getTagValue($this->ferrov, "pesoR");
1904
        $aFont = array(
1905
            'font' => $this->fontePadrao,
1906
            'size' => 6,
1907
            'style' => 'B');
1908
        $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...
1909
        $x += $w * 0.09;
1910
        $this->pdf->line($x, $y, $x, $y1);
1911
        $texto = 'PESO BRUTO/TON';
1912
        $aFont = array(
1913
            'font' => $this->fontePadrao,
1914
            'size' => 6,
1915
            'style' => '');
1916
        $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...
1917
        $texto = $this->getTagValue($this->ferrov, "pesoBC");
1918
        $aFont = array(
1919
            'font' => $this->fontePadrao,
1920
            'size' => 6,
1921
            'style' => 'B');
1922
        $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...
1923
        $x += $w * 0.1;
1924
        $this->pdf->line($x, $y, $x, $y1);
1925
        $texto = 'IDENTIFICAÇÃO DOS CONTÊINERES';
1926
        $aFont = array(
1927
            'font' => $this->fontePadrao,
1928
            'size' => 6,
1929
            'style' => '');
1930
        $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...
1931
        $texto = $this->getTagValue($this->ferrov, "nCont");
1932
        $aFont = array(
1933
            'font' => $this->fontePadrao,
1934
            'size' => 6,
1935
            'style' => 'B');
1936
        $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...
1937
        // FLUXO
1938
        $x = 1;
1939
        $y += 12.9;
1940
        $h1 = $h * 0.5 + 0.27;
1941
        $wa = round($w * 0.103) + 0.5;
1942
        $texto = 'FLUXO FERROVIARIO';
1943
        $aFont = $this->formatPadrao;
1944
        $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...
1945
        $texto = $this->getTagValue($this->ferrov, "fluxo");
1946
        $aFont = array(
1947
            'font' => $this->fontePadrao,
1948
            'size' => 7,
1949
            'style' => 'B');
1950
        $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...
1951
        $y += 10;
1952
        $texto = 'TIPO DE TRÁFEGO';
1953
        $aFont = $this->formatPadrao;
1954
        $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...
1955
        $texto = $this->convertUnidTrafego($this->getTagValue($this->ferrov, "tpTraf"));
1956
        $aFont = array(
1957
            'font' => $this->fontePadrao,
1958
            'size' => 7,
1959
            'style' => 'B');
1960
        $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...
1961
        // Novo Box Relativo a Modal Ferroviário
1962
        $x = 22.5;
1963
        $y += -10.2;
1964
        $texto = 'INFORMAÇÕES DAS FERROVIAS ENVOLVIDAS';
1965
        $aFont = $this->formatPadrao;
1966
        $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...
1967
        $y += 3.4;
1968
        $this->pdf->line($x, $y, $w + 1, $y);
1969
        $w = $w * 0.2;
1970
        $h = $h * 1.04;
1971
        $texto = 'CÓDIGO INTERNO';
1972
        $aFont = array(
1973
            'font' => $this->fontePadrao,
1974
            'size' => 6,
1975
            'style' => '');
1976
        $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...
1977
        $texto = $this->getTagValue($this->ferrov, "cInt");
1978
        $aFont = array(
1979
            'font' => $this->fontePadrao,
1980
            'size' => 6,
1981
            'style' => 'B');
1982
        $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...
1983
        $texto = 'CNPJ';
1984
        $aFont = array(
1985
            'font' => $this->fontePadrao,
1986
            'size' => 6,
1987
            'style' => '');
1988
        $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...
1989
        $texto = $this->getTagValue($this->ferrov, "CNPJ");
1990
        $aFont = array(
1991
            'font' => $this->fontePadrao,
1992
            'size' => 6,
1993
            'style' => 'B');
1994
        $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...
1995
        $x += 50;
1996
        $texto = 'NOME';
1997
        $aFont = array(
1998
            'font' => $this->fontePadrao,
1999
            'size' => 6,
2000
            'style' => '');
2001
        $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...
2002
        $texto = $this->getTagValue($this->ferrov, "xNome");
2003
        $aFont = array(
2004
            'font' => $this->fontePadrao,
2005
            'size' => 6,
2006
            'style' => 'B');
2007
        $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...
2008
        $texto = 'INSCRICAO ESTADUAL';
2009
        $aFont = array(
2010
            'font' => $this->fontePadrao,
2011
            'size' => 6,
2012
            'style' => '');
2013
        $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...
2014
        $texto = $this->getTagValue($this->ferrov, "IE");
2015
        $aFont = array(
2016
            'font' => $this->fontePadrao,
2017
            'size' => 6,
2018
            'style' => 'B');
2019
        $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...
2020
        $x += 50;
2021
        $texto = 'PARTICIPAÇÃO OUTRA FERROVIA';
2022
        $aFont = array(
2023
            'font' => $this->fontePadrao,
2024
            'size' => 6,
2025
            'style' => '');
2026
        $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...
2027
        $texto = '';
2028
        $aFont = array(
2029
            'font' => $this->fontePadrao,
2030
            'size' => 6,
2031
            'style' => 'B');
2032
        $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...
2033
    }
2034
2035
    /**
2036
     * canhoto
2037
     * Monta o campo com os dados do remetente na DACTE.
2038
     *
2039
     * @param  number $x Posição horizontal canto esquerdo
2040
     * @param  number $y Posição vertical canto superior
2041
     * @return number Posição vertical final
2042
     */
2043
    protected function canhoto($x = 0, $y = 0)
2044
    {
2045
        $this->pdf->dashedHLine($x, $y+2, $this->wPrint, 0.1, 80);
2046
        $y = $y + 2;
2047
        $oldX = $x;
2048
        $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...
2049
        if ($this->orientacao == 'P') {
2050
            $maxW = $this->wPrint;
2051
        } else {
2052
            $maxW = $this->wPrint - $this->wCanhoto;
2053
        }
2054
        $w = $maxW - 1;
2055
        $h = 20;
2056
        $y = $y + 1;
2057
        $texto = 'DECLARO QUE RECEBI OS VOLUMES DESTE CONHECIMENTO EM PERFEITO ESTADO ';
2058
        $texto .= 'PELO QUE DOU POR CUMPRIDO O PRESENTE CONTRATO DE TRANSPORTE';
2059
        $aFont = $this->formatPadrao;
2060
        $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...
2061
        $y += 3.4;
2062
        $this->pdf->line($x, $y, $w + 1, $y); // LINHA ABAICO DO TEXTO DECLARO QUE RECEBI...
2063
2064
        $texto = 'NOME';
2065
        $aFont = array(
2066
            'font' => $this->fontePadrao,
2067
            'size' => 6,
2068
            'style' => '');
2069
        $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...
2070
        $x += $w * 0.25;
2071
2072
        $this->pdf->line($x, $y, $x, $y + 16.5);
2073
2074
        $texto = 'ASSINATURA / CARIMBO';
2075
        $aFont = array(
2076
            'font' => $this->fontePadrao,
2077
            'size' => 6,
2078
            'style' => '');
2079
        $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...
2080
        $x += $w * 0.25;
2081
2082
        $this->pdf->line($x, $y, $x, $y + 16.5);
2083
2084
        $texto = 'TÉRMINO DA PRESTAÇÃO - DATA/HORA' . "\r\n" . "\r\n" . "\r\n". "\r\n";
2085
        $texto .= ' INÍCIO DA PRESTAÇÃO - DATA/HORA';
2086
        $aFont = array(
2087
            'font' => $this->fontePadrao,
2088
            'size' => 6,
2089
            'style' => '');
2090
        $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...
2091
        $x = $oldX;
2092
        $y = $y + 5;
2093
2094
        $this->pdf->line($x, $y+3, $w * 0.255, $y+3); // LINHA HORIZONTAL ACIMA DO RG ABAIXO DO NOME
2095
2096
        $texto = 'RG';
2097
        $aFont = array(
2098
            'font' => $this->fontePadrao,
2099
            'size' => 6,
2100
            'style' => '');
2101
        $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...
2102
        $x += $w * 0.85;
2103
2104
        $this->pdf->line($x, $y + 11.5, $x, $y - 5); // LINHA VERTICAL PROXIMO AO CT-E
2105
2106
        $texto = "CT-E OS";
2107
        $aFont = $this->formatNegrito;
2108
        $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...
2109
        $texto = "\r\n Nº. DOCUMENTO  " . $this->getTagValue($this->ide, "nCT") . " \n";
2110
        $texto .= "\r\n SÉRIE  " . $this->getTagValue($this->ide, "serie");
2111
        $aFont = array(
2112
            'font' => $this->fontePadrao,
2113
            'size' => 6,
2114
            'style' => '');
2115
        $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...
2116
        $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...
2117
    }
2118
2119
    /**
2120
     * dadosAdic
2121
     * Coloca o grupo de dados adicionais da DACTE.
2122
     *
2123
     * @param  number $x Posição horizontal canto esquerdo
2124
     * @param  number $y Posição vertical canto superior
2125
     * @param  number $h altura do campo
2126
     * @return number Posição vertical final
2127
     */
2128
    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...
2129
    {
2130
        $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...
2131
        //###########################################################################
2132
        //DADOS ADICIONAIS DACTE
2133
        if ($this->orientacao == 'P') {
2134
            $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...
2135
        } else {
2136
            $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...
2137
        }
2138
        //INFORMAÇÕES COMPLEMENTARES
2139
        $texto = "USO EXCLUSIVO DO EMISSOR DO CT-E";
2140
        $y += 3;
2141
        $w = $this->wAdic;
2142
        $h = 20; //mudar
2143
        $aFont = array(
2144
            'font' => $this->fontePadrao,
2145
            'size' => 6,
2146
            'style' => '');
2147
        $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...
2148
        //$this->pdf->line($x, $y + 3, $w * 1.385, $y + 3);
2149
        $this->pdf->line($x, $y + 3, $w * 1.385, $y + 3);
2150
        //o texto com os dados adicionais foi obtido na função xxxxxx
2151
        //e carregado em uma propriedade privada da classe
2152
        //$this->wAdic com a largura do campo
2153
        //$this->textoAdic com o texto completo do campo
2154
        $y += 1;
2155
        $aFont = $this->formatPadrao;
2156
        $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...
2157
        //RESERVADO AO FISCO
2158
        $texto = "RESERVADO AO FISCO";
2159
        $x += $w;
2160
        $y -= 1;
2161
        if ($this->orientacao == 'P') {
2162
            $w = $this->wPrint - $w;
2163
        } else {
2164
            $w = $this->wPrint - $w - $this->wCanhoto;
2165
        }
2166
        $aFont = array(
2167
            'font' => $this->fontePadrao,
2168
            'size' => 6,
2169
            'style' => '');
2170
        $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...
2171
        //inserir texto informando caso de contingência
2172
        //1 – Normal – emissão normal;
2173
        //2 – Contingência FS – emissão em contingência com impressão do DACTE em Formulário de Segurança;
2174
        //3 – Contingência SCAN – emissão em contingência  – SCAN;
2175
        //4 – Contingência DPEC - emissão em contingência com envio da Declaração Prévia de
2176
        //Emissão em Contingência – DPEC;
2177
        //5 – Contingência FS-DA - emissão em contingência com impressão do DACTE em Formulário de
2178
        //Segurança para Impressão de Documento Auxiliar de Documento Fiscal Eletrônico (FS-DA).
2179
        $xJust = $this->getTagValue($this->ide, 'xJust', 'Justificativa: ');
2180
        $dhCont = $this->getTagValue($this->ide, 'dhCont', ' Entrada em contingência : ');
2181
        $texto = '';
2182
        switch ($this->tpEmis) {
2183
            case 2:
2184
                $texto = 'CONTINGÊNCIA FS' . $dhCont . $xJust;
2185
                break;
2186
            case 3:
2187
                $texto = 'CONTINGÊNCIA SCAN' . $dhCont . $xJust;
2188
                break;
2189
            case 4:
2190
                $texto = 'CONTINGÊNCIA DPEC' . $dhCont . $xJust;
2191
                break;
2192
            case 5:
2193
                $texto = 'CONTINGÊNCIA FSDA' . $dhCont . $xJust;
2194
                break;
2195
        }
2196
        $y += 2;
2197
        $aFont = $this->formatPadrao;
2198
        $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...
2199
        return $y + $h;
2200
    }
2201
2202
    /**
2203
     * formatCNPJCPF
2204
     * Formata campo CnpjCpf contida na CTe
2205
     *
2206
     * @param  string $field campo cnpjCpf da CT-e
2207
     * @return string
2208
     */
2209
    protected function formatCNPJCPF($field)
2210
    {
2211
        if (!isset($field)) {
2212
            return '';
2213
        }
2214
        $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...
2215
            $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...
2216
        if ($cnpj != "" && $cnpj != "00000000000000") {
2217
            $cnpj = $this->formatField($cnpj, '###.###.###/####-##');
2218
        } else {
2219
            $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...
2220
                $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...
2221
        }
2222
        return $cnpj;
2223
    }
2224
2225
    /**
2226
     * formatFone
2227
     * Formata campo fone contida na CTe
2228
     *
2229
     * @param  string $field campo fone da CT-e
2230
     * @return string
2231
     */
2232
    protected function formatFone($field)
2233
    {
2234
        try {
2235
            $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...
2236
            $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...
2237
            $foneLen = strlen($fone);
2238
            if ($foneLen > 0) {
2239
                $fone2 = substr($fone, 0, $foneLen - 4);
2240
                $fone1 = substr($fone, 0, $foneLen - 8);
2241
                $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4);
2242
            } else {
2243
                $fone = '';
2244
            }
2245
            return $fone;
2246
        } catch (Exception $exc) {
2247
            return '';
2248
        }
2249
    }
2250
2251
    /**
2252
     * unidade
2253
     * Converte a imformação de peso contida na CTe
2254
     *
2255
     * @param  string $c unidade de trafego extraida da CTe
2256
     * @return string
2257
     */
2258
    protected function unidade($c = '')
2259
    {
2260
        switch ($c) {
2261
            case '00':
2262
                $r = 'M3';
2263
                break;
2264
            case '01':
2265
                $r = 'KG';
2266
                break;
2267
            case '02':
2268
                $r = 'TON';
2269
                break;
2270
            case '03':
2271
                $r = 'UN';
2272
                break;
2273
            case '04':
2274
                $r = 'LT';
2275
                break;
2276
            case '05':
2277
                $r = 'MMBTU';
2278
                break;
2279
            default:
2280
                $r = '';
2281
        }
2282
        return $r;
2283
    }
2284
2285
    /**
2286
     * convertUnidTrafego
2287
     * Converte a imformação de peso contida na CTe
2288
     *
2289
     * @param  string $U Informação de trafego extraida da CTe
2290
     * @return string
2291
     */
2292
    protected function convertUnidTrafego($U = '')
2293
    {
2294
        if ($U) {
2295
            switch ($U) {
2296
                case '0':
2297
                    $stringU = 'Próprio';
2298
                    break;
2299
                case '1':
2300
                    $stringU = 'Mútuo';
2301
                    break;
2302
                case '2':
2303
                    $stringU = 'Rodoferroviário';
2304
                    break;
2305
                case '3':
2306
                    $stringU = 'Rodoviário';
2307
                    break;
2308
            }
2309
            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...
2310
        }
2311
    }
2312
2313
    /**
2314
     * multiUniPeso
2315
     * Fornece a imformação multiplicação de peso contida na CTe
2316
     *
2317
     * @param  interger $U Informação de peso extraida da CTe
2318
     * @return interger
2319
     */
2320
    protected function multiUniPeso($U = '')
2321
    {
2322
        if ($U === "01") {
2323
            // tonelada
2324
            //return 1000;
2325
            return 1;
2326
        }
2327
        return 1; // M3, KG, Unidade, litros, mmbtu
2328
    }
2329
2330
    protected function qrCodeDacteOs($y = 0)
2331
    {
2332
        $margemInterna = $this->margemInterna;
2333
        $barcode = new Barcode();
2334
        $bobj = $barcode->getBarcodeObj(
2335
            'QRCODE,M',
2336
            $this->qrCodMDFe,
2337
            -4,
2338
            -4,
2339
            'black',
2340
            array(-1, -1, -1, -1)
2341
        )->setBackgroundColor('white');
2342
        $qrcode = $bobj->getPngData();
2343
        $wQr = 36;
2344
        $hQr = 36;
2345
        $yQr = ($y + $margemInterna);
2346
        if ($this->orientacao == 'P') {
2347
            $xQr = 170;
2348
        } else {
2349
            $xQr = 250;
2350
        }
2351
        // prepare a base64 encoded "data url"
2352
        $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
2353
        $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
2354
    }
2355
}
2356