Completed
Push — master ( 27a001...9385d2 )
by Jan
06:11
created
src/Services/Attachments/AttachmentSubmitHandler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -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
     /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
         $fs = new Filesystem();
211 211
         $attachment_folder = $this->generateAttachmentPath($attachment, $options['secure_attachment']);
212
-        $tmp_path = $attachment_folder . DIRECTORY_SEPARATOR . $this->generateAttachmentFilename($attachment, 'tmp');
212
+        $tmp_path = $attachment_folder.DIRECTORY_SEPARATOR.$this->generateAttachmentFilename($attachment, 'tmp');
213 213
 
214 214
         try {
215 215
             $response = $this->httpClient->request('GET', $url, [
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             ]);
218 218
 
219 219
             if (200 !== $response->getStatusCode()) {
220
-                throw new AttachmentDownloadException('Status code: ' . $response->getStatusCode());
220
+                throw new AttachmentDownloadException('Status code: '.$response->getStatusCode());
221 221
             }
222 222
 
223 223
             //Open a temporary file in the attachment folder
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
             }
259 259
 
260 260
             //Rename the file to its new name and save path to attachment entity
261
-            $new_path = $attachment_folder . DIRECTORY_SEPARATOR . $this->generateAttachmentFilename($attachment, $new_ext);
261
+            $new_path = $attachment_folder.DIRECTORY_SEPARATOR.$this->generateAttachmentFilename($attachment, $new_ext);
262 262
             $fs->rename($tmp_path, $new_path);
263 263
 
264 264
             //Make our file path relative to %BASE%
Please login to merge, or discard this patch.
src/Controller/AdminPages/BaseAdminController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                 } catch (AttachmentDownloadException $ex) {
116 116
                     $this->addFlash(
117 117
                         'error',
118
-                        $this->translator->trans('attachment.download_failed') . ' ' . $ex->getMessage()
118
+                        $this->translator->trans('attachment.download_failed').' '.$ex->getMessage()
119 119
                     );
120 120
                 }
121 121
             }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             //Rebuild form, so it is based on the updated data. Important for the parent field!
128 128
             //We can not use dynamic form events here, because the parent entity list is build from database!
129 129
             $form = $this->createForm($this->form_class, $entity, ['attachment_class' => $this->attachment_class]);
130
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
130
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
131 131
             $this->addFlash('error', $this->translator->trans('entity.edit_flash.invalid'));
132 132
         }
133 133
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                 } catch (AttachmentDownloadException $ex) {
172 172
                     $this->addFlash(
173 173
                         'error',
174
-                        $this->translator->trans('attachment.download_failed') . ' ' . $ex->getMessage()
174
+                        $this->translator->trans('attachment.download_failed').' '.$ex->getMessage()
175 175
                     );
176 176
                 }
177 177
             }
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
             $em->flush();
181 181
             $this->addFlash('success', $this->translator->trans('entity.created_flash'));
182 182
 
183
-            return $this->redirectToRoute($this->route_base . '_edit', ['id' => $new_entity->getID()]);
183
+            return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]);
184 184
         }
185 185
 
186
-        if ($form->isSubmitted() && ! $form->isValid()) {
186
+        if ($form->isSubmitted() && !$form->isValid()) {
187 187
             $this->addFlash('error', $this->translator->trans('entity.created_flash.invalid'));
188 188
         }
189 189
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
             foreach ($errors as $name => $error) {
205 205
                 /** @var $error ConstraintViolationList */
206
-                $this->addFlash('error', $name . ':' . $error);
206
+                $this->addFlash('error', $name.':'.$error);
207 207
             }
208 208
         }
209 209
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             //Show errors to user:
223 223
             foreach ($errors as $name => $error) {
224 224
                 /** @var $error ConstraintViolationList */
225
-                $this->addFlash('error', $name . ':' . $error);
225
+                $this->addFlash('error', $name.':'.$error);
226 226
             }
227 227
         }
228 228
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             $this->addFlash('success', 'attachment_type.deleted');
267 267
         }
268 268
 
269
-        return $this->redirectToRoute($this->route_base .  '_new');
269
+        return $this->redirectToRoute($this->route_base.'_new');
270 270
     }
271 271
 
272 272
     protected function _exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
         $entities = $em->getRepository($this->entity_class)->findAll();
279 279
 
280
-        return $exporter->exportEntityFromRequest($entities,$request);
280
+        return $exporter->exportEntityFromRequest($entities, $request);
281 281
     }
282 282
 
283 283
     protected function _exportEntity(NamedDBElement $entity, EntityExporter $exporter, Request $request)
Please login to merge, or discard this patch.
src/Controller/PartController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 } catch (AttachmentDownloadException $ex) {
105 105
                     $this->addFlash(
106 106
                         'error',
107
-                        $translator->trans('attachment.download_failed') . ' ' . $ex->getMessage()
107
+                        $translator->trans('attachment.download_failed').' '.$ex->getMessage()
108 108
                     );
109 109
                 }
110 110
             }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             $this->addFlash('info', $translator->trans('part.edited_flash'));
116 116
             //Reload form, so the SIUnitType entries use the new part unit
117 117
             $form = $this->createForm(PartBaseType::class, $part);
118
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
118
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
119 119
             $this->addFlash('error', $translator->trans('part.edited_flash.invalid'));
120 120
         }
121 121
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     {
138 138
         $this->denyAccessUnlessGranted('delete', $part);
139 139
 
140
-        if ($this->isCsrfTokenValid('delete' . $part->getId(), $request->request->get('_token'))) {
140
+        if ($this->isCsrfTokenValid('delete'.$part->getId(), $request->request->get('_token'))) {
141 141
             $entityManager = $this->getDoctrine()->getManager();
142 142
 
143 143
             //Remove part
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 } catch (AttachmentDownloadException $ex) {
191 191
                     $this->addFlash(
192 192
                         'error',
193
-                        $translator->trans('attachment.download_failed') . ' ' . $ex->getMessage()
193
+                        $translator->trans('attachment.download_failed').' '.$ex->getMessage()
194 194
                     );
195 195
                 }
196 196
             }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
             return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
203 203
         }
204 204
 
205
-        if ($form->isSubmitted() && ! $form->isValid()) {
205
+        if ($form->isSubmitted() && !$form->isValid()) {
206 206
             $this->addFlash('error', $translator->trans('part.created_flash.invalid'));
207 207
         }
208 208
 
Please login to merge, or discard this patch.