@@ -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 | |
@@ -382,11 +382,11 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | $certPath = $dacteKey->getConfigValue(); |
| 384 | 384 | |
| 385 | - if (! $certPath) |
|
| 386 | - throw new \Exception("Key cert path is invalid: " . $certPath, 1); |
|
| 385 | + if (!$certPath) |
|
| 386 | + throw new \Exception("Key cert path is invalid: ".$certPath, 1); |
|
| 387 | 387 | $certContent = $this->manager->getRepository(File::class)->find($dacteKey->getConfigValue()); |
| 388 | 388 | if (!$certContent) |
| 389 | - throw new \Exception("Key content on table files is empty " . $certPath, 1); |
|
| 389 | + throw new \Exception("Key content on table files is empty ".$certPath, 1); |
|
| 390 | 390 | |
| 391 | 391 | return Certificate::readPfx( |
| 392 | 392 | $certContent->getContent(), |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $tpEmis, |
| 503 | 503 | $codigo |
| 504 | 504 | ); |
| 505 | - return $chave . $this->calculaDV($chave); |
|
| 505 | + return $chave.$this->calculaDV($chave); |
|
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | |
@@ -377,16 +377,19 @@ |
||
| 377 | 377 | 'people' => $provider, |
| 378 | 378 | 'configKey' => 'cert-pass' |
| 379 | 379 | ]); |
| 380 | - if (!$dacteKey || !$dacteKeyPass) |
|
| 381 | - throw new \Exception("Key cert is required", 1); |
|
| 380 | + if (!$dacteKey || !$dacteKeyPass) { |
|
| 381 | + throw new \Exception("Key cert is required", 1); |
|
| 382 | + } |
|
| 382 | 383 | |
| 383 | 384 | $certPath = $dacteKey->getConfigValue(); |
| 384 | 385 | |
| 385 | - if (! $certPath) |
|
| 386 | - throw new \Exception("Key cert path is invalid: " . $certPath, 1); |
|
| 386 | + if (! $certPath) { |
|
| 387 | + throw new \Exception("Key cert path is invalid: " . $certPath, 1); |
|
| 388 | + } |
|
| 387 | 389 | $certContent = $this->manager->getRepository(File::class)->find($dacteKey->getConfigValue()); |
| 388 | - if (!$certContent) |
|
| 389 | - throw new \Exception("Key content on table files is empty " . $certPath, 1); |
|
| 390 | + if (!$certContent) { |
|
| 391 | + throw new \Exception("Key content on table files is empty " . $certPath, 1); |
|
| 392 | + } |
|
| 390 | 393 | |
| 391 | 394 | return Certificate::readPfx( |
| 392 | 395 | $certContent->getContent(), |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | class NFeService extends NFePHP |
| 11 | 11 | { |
| 12 | - public function createNfe(Order $order, $model, $version = '4.00') |
|
| 12 | + public function createNfe(Order $order, $model, $version = '4.00') |
|
| 13 | 13 | { |
| 14 | 14 | |
| 15 | 15 | $this->model = $model; |