@@ -7,7 +7,7 @@  | 
                                                    ||
| 7 | 7 | |
| 8 | 8 | class NFeService extends NFePHP  | 
                                                        
| 9 | 9 |  { | 
                                                        
| 10 | - public function createNfe(Order $order, $model, $version = '4.0')  | 
                                                        |
| 10 | + public function createNfe(Order $order, $model, $version = '4.0')  | 
                                                        |
| 11 | 11 |      { | 
                                                        
| 12 | 12 | |
| 13 | 13 | $this->model = $model;  | 
                                                        
@@ -44,7 +44,7 @@ discard block  | 
                                                    ||
| 44 | 44 | |
| 45 | 45 | public function downloadNf(InvoiceTax $invoiceTax, $format = 'pdf')  | 
                                                        
| 46 | 46 |      { | 
                                                        
| 47 | - $method = 'get' . ucfirst(strtolower($format));  | 
                                                        |
| 47 | + $method = 'get'.ucfirst(strtolower($format));  | 
                                                        |
| 48 | 48 | if (method_exists($this, $method) === false)  | 
                                                        
| 49 | 49 | throw new InvalidValueException(  | 
                                                        
| 50 | 50 |                  sprintf('Format "%s" is not available', $format) | 
                                                        
@@ -53,7 +53,7 @@ discard block  | 
                                                    ||
| 53 | 53 | if (($content = $this->$method($invoiceTax)) === null)  | 
                                                        
| 54 | 54 |              throw new InvalidValueException('File content is empty'); | 
                                                        
| 55 | 55 | |
| 56 | -        $response = new StreamedResponse(function () use ($content) { | 
                                                        |
| 56 | +        $response = new StreamedResponse(function() use ($content) { | 
                                                        |
| 57 | 57 |              fputs(fopen('php://output', 'wb'), $content); | 
                                                        
| 58 | 58 | });  | 
                                                        
| 59 | 59 | |
@@ -114,10 +114,10 @@ discard block  | 
                                                    ||
| 114 | 114 | return $pixel;  | 
                                                        
| 115 | 115 | |
| 116 | 116 |          if (($file = $people->getFile()) !== null) { | 
                                                        
| 117 | - $path = $root . '/' . $file->getPath();  | 
                                                        |
| 117 | + $path = $root.'/'.$file->getPath();  | 
                                                        |
| 118 | 118 | |
| 119 | 119 | if (strpos($file->getPath(), 'data/') !== false)  | 
                                                        
| 120 | -                $path = $root . '/' . str_replace('data/', 'public/', $file->getPath()); | 
                                                        |
| 120 | +                $path = $root.'/'.str_replace('data/', 'public/', $file->getPath()); | 
                                                        |
| 121 | 121 | |
| 122 | 122 | $parts = pathinfo($path);  | 
                                                        
| 123 | 123 | if ($parts['extension'] != 'jpg')  | 
                                                        
@@ -45,13 +45,15 @@ discard block  | 
                                                    ||
| 45 | 45 | public function downloadNf(InvoiceTax $invoiceTax, $format = 'pdf')  | 
                                                        
| 46 | 46 |      { | 
                                                        
| 47 | 47 | $method = 'get' . ucfirst(strtolower($format));  | 
                                                        
| 48 | - if (method_exists($this, $method) === false)  | 
                                                        |
| 49 | - throw new InvalidValueException(  | 
                                                        |
| 48 | +        if (method_exists($this, $method) === false) { | 
                                                        |
| 49 | + throw new InvalidValueException(  | 
                                                        |
| 50 | 50 |                  sprintf('Format "%s" is not available', $format) | 
                                                        
| 51 | 51 | );  | 
                                                        
| 52 | + }  | 
                                                        |
| 52 | 53 | |
| 53 | - if (($content = $this->$method($invoiceTax)) === null)  | 
                                                        |
| 54 | -            throw new InvalidValueException('File content is empty'); | 
                                                        |
| 54 | +        if (($content = $this->$method($invoiceTax)) === null) { | 
                                                        |
| 55 | +                    throw new InvalidValueException('File content is empty'); | 
                                                        |
| 56 | + }  | 
                                                        |
| 55 | 57 | |
| 56 | 58 |          $response = new StreamedResponse(function () use ($content) { | 
                                                        
| 57 | 59 |              fputs(fopen('php://output', 'wb'), $content); | 
                                                        
@@ -110,18 +112,21 @@ discard block  | 
                                                    ||
| 110 | 112 |          $pixel = sprintf('%s/data/files/users/white-pixel.jpg', $root); | 
                                                        
| 111 | 113 | $path = $pixel;  | 
                                                        
| 112 | 114 | |
| 113 | - if ($people === null)  | 
                                                        |
| 114 | - return $pixel;  | 
                                                        |
| 115 | +        if ($people === null) { | 
                                                        |
| 116 | + return $pixel;  | 
                                                        |
| 117 | + }  | 
                                                        |
| 115 | 118 | |
| 116 | 119 |          if (($file = $people->getFile()) !== null) { | 
                                                        
| 117 | 120 | $path = $root . '/' . $file->getPath();  | 
                                                        
| 118 | 121 | |
| 119 | - if (strpos($file->getPath(), 'data/') !== false)  | 
                                                        |
| 120 | -                $path = $root . '/' . str_replace('data/', 'public/', $file->getPath()); | 
                                                        |
| 122 | +            if (strpos($file->getPath(), 'data/') !== false) { | 
                                                        |
| 123 | +                            $path = $root . '/' . str_replace('data/', 'public/', $file->getPath()); | 
                                                        |
| 124 | + }  | 
                                                        |
| 121 | 125 | |
| 122 | 126 | $parts = pathinfo($path);  | 
                                                        
| 123 | - if ($parts['extension'] != 'jpg')  | 
                                                        |
| 124 | - return $pixel;  | 
                                                        |
| 127 | +            if ($parts['extension'] != 'jpg') { | 
                                                        |
| 128 | + return $pixel;  | 
                                                        |
| 129 | + }  | 
                                                        |
| 125 | 130 | }  | 
                                                        
| 126 | 131 | |
| 127 | 132 | return $path;  | 
                                                        
@@ -50,7 +50,7 @@ discard block  | 
                                                    ||
| 50 | 50 | '10'  | 
                                                        
| 51 | 51 | );  | 
                                                        
| 52 | 52 | |
| 53 | - $cDV = substr($chave, -1); //Digito Verificador  | 
                                                        |
| 53 | + $cDV = substr($chave, -1); //Digito Verificador  | 
                                                        |
| 54 | 54 | |
| 55 | 55 | /**  | 
                                                        
| 56 | 56 | * @todo  | 
                                                        
@@ -109,7 +109,7 @@ discard block  | 
                                                    ||
| 109 | 109 | $ide->xDetRetira = ''; // Detalhes do retira  | 
                                                        
| 110 | 110 | $ide->indIEToma = '1';  | 
                                                        
| 111 | 111 | $ide->dhCont = ''; // Data e Hora da entrada em contingência; no formato AAAAMM-DDTHH:MM:SS  | 
                                                        
| 112 | - $ide->xJust = ''; // Justificativa da entrada em contingência  | 
                                                        |
| 112 | + $ide->xJust = ''; // Justificativa da entrada em contingência  | 
                                                        |
| 113 | 113 | |
| 114 | 114 | $this->make->tagide($ide);  | 
                                                        
| 115 | 115 | }  | 
                                                        
@@ -157,7 +157,7 @@ discard block  | 
                                                    ||
| 157 | 157 | $enderToma->CEP = '95720000'; // CEP  | 
                                                        
| 158 | 158 | $enderToma->UF = 'SP'; //$arr['siglaUF']; // Sigla UF (Informar EX para operações com o exterior.)  | 
                                                        
| 159 | 159 | $enderToma->cPais = '1058'; // Codigo do país ( Utilizar a tabela do BACEN )  | 
                                                        
| 160 | - $enderToma->xPais = 'Brasil'; // Nome do pais  | 
                                                        |
| 160 | + $enderToma->xPais = 'Brasil'; // Nome do pais  | 
                                                        |
| 161 | 161 | $this->make->tagenderToma($enderToma);  | 
                                                        
| 162 | 162 | }  | 
                                                        
| 163 | 163 | |
@@ -204,9 +204,9 @@ discard block  | 
                                                    ||
| 204 | 204 | $enderEmit->xBairro = $providerAddress->getStreet()->getDistrict()->getDistrict(); // Bairro  | 
                                                        
| 205 | 205 | $enderEmit->xMun = $providerAddress->getStreet()->getDistrict()->getCity()->getCity(); // Nome do municipio  | 
                                                        
| 206 | 206 | $enderEmit->CEP = $providerAddress->getStreet()->getCep()->getCep(); // CEP  | 
                                                        
| 207 | - $enderEmit->UF = $providerAddress->getStreet()->getDistrict()->getCity()->getState()->getUf(); // Sigla UF  | 
                                                        |
| 207 | + $enderEmit->UF = $providerAddress->getStreet()->getDistrict()->getCity()->getState()->getUf(); // Sigla UF  | 
                                                        |
| 208 | 208 | $enderEmit->cMun = $this->getCodMunicipio($enderEmit->xMun, $enderEmit->UF); // Código do município (utilizar a tabela do IBGE)  | 
                                                        
| 209 | - $enderEmit->fone = $provider->getPhone()[0]->getDdd() . $provider->getPhone()[0]->getPhone(); // Fone  | 
                                                        |
| 209 | + $enderEmit->fone = $provider->getPhone()[0]->getDdd().$provider->getPhone()[0]->getPhone(); // Fone  | 
                                                        |
| 210 | 210 | $this->make->tagenderemit($enderEmit);  | 
                                                        
| 211 | 211 | }  | 
                                                        
| 212 | 212 | //dest OPCIONAL  | 
                                                        
@@ -249,7 +249,7 @@ discard block  | 
                                                    ||
| 249 | 249 | //prod OBRIGATÓRIA  | 
                                                        
| 250 | 250 | protected function makeProds(Order $order)  | 
                                                        
| 251 | 251 |      { | 
                                                        
| 252 | - $orderProducts = $order->getOrderProducts();  | 
                                                        |
| 252 | + $orderProducts = $order->getOrderProducts();  | 
                                                        |
| 253 | 253 | $item = 1;  | 
                                                        
| 254 | 254 |          foreach ($orderProducts as $orderProducts) { | 
                                                        
| 255 | 255 | $product = $orderProducts->getProduct();  | 
                                                        
@@ -312,7 +312,7 @@ discard block  | 
                                                    ||
| 312 | 312 | //infNFe OBRIGATÓRIA  | 
                                                        
| 313 | 313 | $std = new \stdClass();  | 
                                                        
| 314 | 314 | $std->Id = '';  | 
                                                        
| 315 | - $std->versao = $version;  | 
                                                        |
| 315 | + $std->versao = $version;  | 
                                                        |
| 316 | 316 | $this->make->taginfNFe($std);  | 
                                                        
| 317 | 317 | }  | 
                                                        
| 318 | 318 | |
@@ -380,7 +380,7 @@ discard block  | 
                                                    ||
| 380 | 380 | if (!$dacteKey || !$dacteKeyPass)  | 
                                                        
| 381 | 381 |              throw new \Exception("DACTE key cert is required", 1); | 
                                                        
| 382 | 382 | |
| 383 | - $certPath = $this->appKernel->getProjectDir() . $dacteKey->getConfigValue();  | 
                                                        |
| 383 | + $certPath = $this->appKernel->getProjectDir().$dacteKey->getConfigValue();  | 
                                                        |
| 384 | 384 | if (!is_file($certPath))  | 
                                                        
| 385 | 385 |              throw new \Exception("DACTE key cert path is invalid", 1); | 
                                                        
| 386 | 386 | return Certificate::readPfx($this->getSignData($order), $dacteKeyPass->getConfigValue());  | 
                                                        
@@ -494,7 +494,7 @@ discard block  | 
                                                    ||
| 494 | 494 | $tpEmis,  | 
                                                        
| 495 | 495 | $codigo  | 
                                                        
| 496 | 496 | );  | 
                                                        
| 497 | - return $chave . $this->calculaDV($chave);  | 
                                                        |
| 497 | + return $chave.$this->calculaDV($chave);  | 
                                                        |
| 498 | 498 | }  | 
                                                        
| 499 | 499 | |
| 500 | 500 | |
@@ -377,12 +377,14 @@  | 
                                                    ||
| 377 | 377 | 'people' => $provider,  | 
                                                        
| 378 | 378 | 'config_key' => 'cert-pass'  | 
                                                        
| 379 | 379 | ]);  | 
                                                        
| 380 | - if (!$dacteKey || !$dacteKeyPass)  | 
                                                        |
| 381 | -            throw new \Exception("DACTE key cert is required", 1); | 
                                                        |
| 380 | +        if (!$dacteKey || !$dacteKeyPass) { | 
                                                        |
| 381 | +                    throw new \Exception("DACTE key cert is required", 1); | 
                                                        |
| 382 | + }  | 
                                                        |
| 382 | 383 | |
| 383 | 384 | $certPath = $this->appKernel->getProjectDir() . $dacteKey->getConfigValue();  | 
                                                        
| 384 | - if (!is_file($certPath))  | 
                                                        |
| 385 | -            throw new \Exception("DACTE key cert path is invalid", 1); | 
                                                        |
| 385 | +        if (!is_file($certPath)) { | 
                                                        |
| 386 | +                    throw new \Exception("DACTE key cert path is invalid", 1); | 
                                                        |
| 387 | + }  | 
                                                        |
| 386 | 388 | return Certificate::readPfx($this->getSignData($order), $dacteKeyPass->getConfigValue());  | 
                                                        
| 387 | 389 | }  | 
                                                        
| 388 | 390 | |