Passed
Push — master ( 44e8a7...e83590 )
by Luiz Kim
13:16 queued 05:49
created
src/Service/DownloadNFService.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,13 +45,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Library/NFePHP.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -377,16 +377,19 @@
 block discarded – undo
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(),
Please login to merge, or discard this patch.