@@ -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; |
@@ -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 | |