@@ -56,14 +56,16 @@ |
||
| 56 | 56 | 'people' => $provider, |
| 57 | 57 | 'config_key' => 'dacte-key-pass' |
| 58 | 58 | ]); |
| 59 | - if (!$dacteKey || !$dacteKeyPass) |
|
| 60 | - throw new \Exception("DACTE key cert is required", 1); |
|
| 59 | + if (!$dacteKey || !$dacteKeyPass) { |
|
| 60 | + throw new \Exception("DACTE key cert is required", 1); |
|
| 61 | + } |
|
| 61 | 62 | |
| 62 | 63 | |
| 63 | 64 | |
| 64 | 65 | $certPath = $this->appKernel->getProjectDir() . $dacteKey->getConfigValue(); |
| 65 | - if (!is_file($certPath)) |
|
| 66 | - throw new \Exception("DACTE key cert path is invalid", 1); |
|
| 66 | + if (!is_file($certPath)) { |
|
| 67 | + throw new \Exception("DACTE key cert path is invalid", 1); |
|
| 68 | + } |
|
| 67 | 69 | |
| 68 | 70 | |
| 69 | 71 | /** |
@@ -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; |