Completed
Push — master ( 9385d2...63dc22 )
by Jan
04:27
created
src/Form/AttachmentFormType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
         //Check the secure file checkbox, if file is in securefile location
130 130
         $builder->get('secureFile')->addEventListener(
131 131
             FormEvents::PRE_SET_DATA,
132
-            function (FormEvent $event) {
132
+            function(FormEvent $event) {
133 133
                 $attachment = $event->getForm()->getParent()->getData();
134 134
                 if ($attachment instanceof Attachment) {
135 135
                     $event->setData($attachment->isSecure());
Please login to merge, or discard this patch.
src/Services/Attachments/AttachmentSubmitHandler.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     protected $httpClient;
73 73
     protected $mimeTypes;
74 74
 
75
-    public function __construct (AttachmentPathResolver $pathResolver, bool $allow_attachments_downloads,
75
+    public function __construct(AttachmentPathResolver $pathResolver, bool $allow_attachments_downloads,
76 76
                                 HttpClientInterface $httpClient, MimeTypesInterface $mimeTypes)
77 77
     {
78 78
         $this->pathResolver = $pathResolver;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             $attachment->getName()
122 122
         );
123 123
 
124
-        return $safeName . '-' . uniqid('', false) . '.' . $extension;
124
+        return $safeName.'-'.uniqid('', false).'.'.$extension;
125 125
     }
126 126
 
127 127
     /**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         //Ensure the given attachment class is known to mapping
142 142
         if (!isset($this->folder_mapping[get_class($attachment)])) {
143 143
             throw new \InvalidArgumentException(
144
-                'The given attachment class is not known! The passed class was: ' . get_class($attachment)
144
+                'The given attachment class is not known! The passed class was: '.get_class($attachment)
145 145
             );
146 146
         }
147 147
         //Ensure the attachment has an assigned element
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 
154 154
         //Build path
155 155
         return
156
-            $base_path . DIRECTORY_SEPARATOR //Base path
157
-            . $this->folder_mapping[get_class($attachment)] . DIRECTORY_SEPARATOR . $attachment->getElement()->getID();
156
+            $base_path.DIRECTORY_SEPARATOR //Base path
157
+            . $this->folder_mapping[get_class($attachment)].DIRECTORY_SEPARATOR.$attachment->getElement()->getID();
158 158
     }
159 159
 
160 160
     /**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         $ext = pathinfo($filename, PATHINFO_EXTENSION);
229 229
         $new_path = $this->generateAttachmentPath($attachment, $secure_location)
230
-            . DIRECTORY_SEPARATOR . $this->generateAttachmentFilename($attachment, $ext);
230
+            . DIRECTORY_SEPARATOR.$this->generateAttachmentFilename($attachment, $ext);
231 231
 
232 232
         //Move file to new directory
233 233
         $fs = new Filesystem();
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
         $fs = new Filesystem();
259 259
         $attachment_folder = $this->generateAttachmentPath($attachment, $options['secure_attachment']);
260
-        $tmp_path = $attachment_folder . DIRECTORY_SEPARATOR . $this->generateAttachmentFilename($attachment, 'tmp');
260
+        $tmp_path = $attachment_folder.DIRECTORY_SEPARATOR.$this->generateAttachmentFilename($attachment, 'tmp');
261 261
 
262 262
         try {
263 263
             $response = $this->httpClient->request('GET', $url, [
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
             ]);
266 266
 
267 267
             if (200 !== $response->getStatusCode()) {
268
-                throw new AttachmentDownloadException('Status code: ' . $response->getStatusCode());
268
+                throw new AttachmentDownloadException('Status code: '.$response->getStatusCode());
269 269
             }
270 270
 
271 271
             //Open a temporary file in the attachment folder
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
             }
307 307
 
308 308
             //Rename the file to its new name and save path to attachment entity
309
-            $new_path = $attachment_folder . DIRECTORY_SEPARATOR . $this->generateAttachmentFilename($attachment, $new_ext);
309
+            $new_path = $attachment_folder.DIRECTORY_SEPARATOR.$this->generateAttachmentFilename($attachment, $new_ext);
310 310
             $fs->rename($tmp_path, $new_path);
311 311
 
312 312
             //Make our file path relative to %BASE%
Please login to merge, or discard this patch.