Completed
Push — master ( 200168...ac238c )
by Jan
04:52
created
src/Services/AttachmentHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
         if ($fs->isAbsolutePath($tmp_base_path)) {
75 75
             $this->base_path = $tmp_base_path;
76 76
         } else {
77
-            $this->base_path = realpath($kernel->getProjectDir() . DIRECTORY_SEPARATOR . $tmp_base_path);
77
+            $this->base_path = realpath($kernel->getProjectDir().DIRECTORY_SEPARATOR.$tmp_base_path);
78 78
         }
79 79
 
80
-        $this->footprints_path = realpath($kernel->getProjectDir() . "/public/img/footprints");
80
+        $this->footprints_path = realpath($kernel->getProjectDir()."/public/img/footprints");
81 81
         //TODO
82 82
         $this->footprints_3d_path = "TODO";
83 83
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $placeholder_path = str_replace($placeholders, $targets, $placeholder_path);
122 122
 
123 123
         //Normalize path and remove ..
124
-        $placeholder_path = str_replace(['\\','..'], ['/',''], $placeholder_path);
124
+        $placeholder_path = str_replace(['\\', '..'], ['/', ''], $placeholder_path);
125 125
 
126 126
         return $placeholder_path;
127 127
     }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
         $sz = 'BKMGTP';
222 222
         $factor = (int) floor((strlen($bytes) - 1) / 3);
223
-        return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor) . @$sz[$factor];
223
+        return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor).@$sz[$factor];
224 224
     }
225 225
 
226 226
     /**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
             MeasurementUnitAttachment::class => 'measurement_unit', StorelocationAttachment::class => 'storelocation',
238 238
             SupplierAttachment::class => 'supplier', UserAttachment::class => 'user'];
239 239
 
240
-        $path = $this->base_path . DIRECTORY_SEPARATOR . $mapping[get_class($attachment)] . DIRECTORY_SEPARATOR . $attachment->getElement()->getID();
240
+        $path = $this->base_path.DIRECTORY_SEPARATOR.$mapping[get_class($attachment)].DIRECTORY_SEPARATOR.$attachment->getElement()->getID();
241 241
         return $path;
242 242
     }
243 243
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
         //Sanatize filename
260 260
         $originalFilename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
261
-        $newFilename = $attachment->getName() . '-' . uniqid('', false) . '.' . $file->guessExtension();
261
+        $newFilename = $attachment->getName().'-'.uniqid('', false).'.'.$file->guessExtension();
262 262
 
263 263
         //Move our temporay attachment to its final location
264 264
         $file_path = $file->move($folder, $newFilename)->getRealPath();
Please login to merge, or discard this patch.