Completed
Push — master ( 1f7c12...27a001 )
by Jan
04:25
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('Statuscode:' . $response->getStatusCode());
220
+                throw new AttachmentDownloadException('Statuscode:'.$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/Services/AttachmentHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
 
166 166
         $sz = 'BKMGTP';
167 167
         $factor = (int) floor((strlen($bytes) - 1) / 3);
168
-        return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor) . @$sz[$factor];
168
+        return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor).@$sz[$factor];
169 169
     }
170 170
 
171 171
 
Please login to merge, or discard this patch.
src/Controller/AdminPages/BaseAdminController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             //Rebuild form, so it is based on the updated data. Important for the parent field!
120 120
             //We can not use dynamic form events here, because the parent entity list is build from database!
121 121
             $form = $this->createForm($this->form_class, $entity, ['attachment_class' => $this->attachment_class]);
122
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
122
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
123 123
             $this->addFlash('error', $this->translator->trans('entity.edit_flash.invalid'));
124 124
         }
125 125
 
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
             $em->flush();
162 162
             $this->addFlash('success', $this->translator->trans('entity.created_flash'));
163 163
 
164
-            return $this->redirectToRoute($this->route_base . '_edit', ['id' => $new_entity->getID()]);
164
+            return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]);
165 165
         }
166 166
 
167
-        if ($form->isSubmitted() && ! $form->isValid()) {
167
+        if ($form->isSubmitted() && !$form->isValid()) {
168 168
             $this->addFlash('error', $this->translator->trans('entity.created_flash.invalid'));
169 169
         }
170 170
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
             foreach ($errors as $name => $error) {
186 186
                 /** @var $error ConstraintViolationList */
187
-                $this->addFlash('error', $name . ':' . $error);
187
+                $this->addFlash('error', $name.':'.$error);
188 188
             }
189 189
         }
190 190
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             //Show errors to user:
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
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             $this->addFlash('success', 'attachment_type.deleted');
248 248
         }
249 249
 
250
-        return $this->redirectToRoute($this->route_base .  '_new');
250
+        return $this->redirectToRoute($this->route_base.'_new');
251 251
     }
252 252
 
253 253
     protected function _exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
         $entities = $em->getRepository($this->entity_class)->findAll();
260 260
 
261
-        return $exporter->exportEntityFromRequest($entities,$request);
261
+        return $exporter->exportEntityFromRequest($entities, $request);
262 262
     }
263 263
 
264 264
     protected function _exportEntity(NamedDBElement $entity, EntityExporter $exporter, Request $request)
Please login to merge, or discard this patch.
src/Controller/PartController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             $this->addFlash('info', $translator->trans('part.edited_flash'));
104 104
             //Reload form, so the SIUnitType entries use the new part unit
105 105
             $form = $this->createForm(PartBaseType::class, $part);
106
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
106
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
107 107
             $this->addFlash('error', $translator->trans('part.edited_flash.invalid'));
108 108
         }
109 109
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $this->denyAccessUnlessGranted('delete', $part);
127 127
 
128
-        if ($this->isCsrfTokenValid('delete' . $part->getId(), $request->request->get('_token'))) {
128
+        if ($this->isCsrfTokenValid('delete'.$part->getId(), $request->request->get('_token'))) {
129 129
             $entityManager = $this->getDoctrine()->getManager();
130 130
 
131 131
             //Remove part
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
180 180
         }
181 181
 
182
-        if ($form->isSubmitted() && ! $form->isValid()) {
182
+        if ($form->isSubmitted() && !$form->isValid()) {
183 183
             $this->addFlash('error', $translator->trans('part.created_flash.invalid'));
184 184
         }
185 185
 
Please login to merge, or discard this patch.