Passed
Pull Request — master (#408)
by
unknown
03:57
created
src/NFe/DanfeSimples.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -193,6 +193,9 @@
 block discarded – undo
193 193
         $this->orientacao = $orientacao;
194 194
     }
195 195
 
196
+    /**
197
+     * @param string $xml
198
+     */
196 199
     private function loadDoc($xml)
197 200
     {
198 201
         $this->xml = $xml;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
             $stdClass = simplexml_load_string($xml);
201 201
             $json = json_encode($stdClass, JSON_OBJECT_AS_ARRAY);
202 202
             $this->nfeArray = json_decode($json, JSON_OBJECT_AS_ARRAY);
203
-            if (!isset($this->nfeArray['NFe']['infNFe']['@attributes']['Id'])){
203
+            if (!isset($this->nfeArray['NFe']['infNFe']['@attributes']['Id'])) {
204 204
                 throw new Exception('XML não parece ser uma NF-e!');
205 205
             }
206
-            if ($this->nfeArray['protNFe']['infProt']['cStat'] != '100'){
206
+            if ($this->nfeArray['protNFe']['infProt']['cStat'] != '100') {
207 207
                 throw new Exception('NF-e não autorizada!');
208 208
             }
209 209
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $this->pdf->setFont('Arial', 'B', 10);
254 254
         $this->pdf->cell($c1, 5, "TIPO NF", 1, 0, 'C', 1);
255 255
         $this->pdf->setFont('Arial', '', 10);
256
-        $this->pdf->cell($c1, 5, "{$this->nfeArray['NFe']['infNFe']['ide']['tpNF']} - ".($this->nfeArray['NFe']['infNFe']['ide']['tpNF']==1 ? 'Saida':'Entrada'), 1, 0, 'C', 1);
256
+        $this->pdf->cell($c1, 5, "{$this->nfeArray['NFe']['infNFe']['ide']['tpNF']} - " . ($this->nfeArray['NFe']['infNFe']['ide']['tpNF'] == 1 ? 'Saida' : 'Entrada'), 1, 0, 'C', 1);
257 257
         $this->pdf->setFont('Arial', 'B', 10);
258 258
         $this->pdf->cell($c1, 5, "DATA EMISSAO", 1, 0, 'C', 1);
259 259
         $this->pdf->setFont('Arial', '', 10);
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $this->pdf->ln();
287 287
         $y = $this->pdf->getY();
288 288
         $this->pdf->setFillColor(0, 0, 0);
289
-        $this->pdf->code128(($c1/2), $y, $chave, ($c1 * 3), 15);
289
+        $this->pdf->code128(($c1 / 2), $y, $chave, ($c1 * 3), 15);
290 290
         $this->pdf->setFillColor(255, 255, 255);
291 291
         $this->pdf->ln();
292 292
         $this->pdf->ln();
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         $this->pdf->cell(($c1 * 4), 5, "{$this->nfeArray['NFe']['infNFe']['emit']['xNome']}", 1, 1, 'C', 1);
303 303
         
304 304
         // LINHA 8
305
-        $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['emit']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['emit']['CNPJ']:$this->nfeArray['NFe']['infNFe']['emit']['CPF']);
305
+        $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['emit']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['emit']['CNPJ'] : $this->nfeArray['NFe']['infNFe']['emit']['CPF']);
306 306
         $this->pdf->cell(($c1 * 2), 5, "CNPJ/CPF {$cpfCnpj}", 1, 0, 'C', 1);
307 307
         $this->pdf->cell(($c1 * 2), 5, @"RG/IE {$this->nfeArray['NFe']['infNFe']['emit']['IE']}", 1, 1, 'C', 1);
308 308
 
@@ -315,27 +315,27 @@  discard block
 block discarded – undo
315 315
         $this->pdf->cell(($c1 * 4), 5, "{$this->nfeArray['NFe']['infNFe']['dest']['xNome']}", 1, 1, 'C', 1);
316 316
         
317 317
         // LINHA 11
318
-        $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['dest']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['dest']['CNPJ']:$this->nfeArray['NFe']['infNFe']['dest']['CPF']);
318
+        $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['dest']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['dest']['CNPJ'] : $this->nfeArray['NFe']['infNFe']['dest']['CPF']);
319 319
         $this->pdf->cell(($c1 * 2), 5, "CNPJ/CPF {$cpfCnpj}", 1, 0, 'C', 1);
320 320
         $this->pdf->cell(($c1 * 2), 5, @"RG/IE {$this->nfeArray['NFe']['infNFe']['dest']['IE']}", 1, 1, 'C', 1);
321 321
 
322
-        if (isset($this->nfeArray['NFe']['infNFe']['entrega'])){
322
+        if (isset($this->nfeArray['NFe']['infNFe']['entrega'])) {
323 323
             $enderecoLinha1 = "{$this->nfeArray['NFe']['infNFe']['entrega']['xLgr']}";
324
-            if (!empty($this->nfeArray['NFe']['infNFe']['entrega']['nro'])){
324
+            if (!empty($this->nfeArray['NFe']['infNFe']['entrega']['nro'])) {
325 325
                 $enderecoLinha1 .= ", {$this->nfeArray['NFe']['infNFe']['entrega']['nro']}";
326 326
             }
327 327
             $enderecoLinha2 = '';
328
-            if (!empty($this->nfeArray['NFe']['infNFe']['entrega']['xCpl'])){
328
+            if (!empty($this->nfeArray['NFe']['infNFe']['entrega']['xCpl'])) {
329 329
                 $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['entrega']['xCpl']} - ";
330 330
             }
331 331
             $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['entrega']['xMun']} / {$this->nfeArray['NFe']['infNFe']['entrega']['UF']} - CEP {$this->nfeArray['NFe']['infNFe']['entrega']['CEP']}";
332 332
         } else {
333 333
             $enderecoLinha1 = "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xLgr']}";
334
-            if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['nro'])){
334
+            if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['nro'])) {
335 335
                 $enderecoLinha1 .= ", {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['nro']}";
336 336
             }
337 337
             $enderecoLinha2 = '';
338
-            if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xCpl'])){
338
+            if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xCpl'])) {
339 339
                 $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xCpl']} - ";
340 340
             }
341 341
             $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xMun']} / {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['UF']} - CEP {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['CEP']}";
Please login to merge, or discard this patch.