@@ -74,10 +74,10 @@ discard block |
||
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 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | $sz = 'BKMGTP'; |
225 | 225 | $factor = (int) floor((strlen($bytes) - 1) / 3); |
226 | - return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor) . @$sz[$factor]; |
|
226 | + return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor).@$sz[$factor]; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | MeasurementUnitAttachment::class => 'measurement_unit', StorelocationAttachment::class => 'storelocation', |
241 | 241 | SupplierAttachment::class => 'supplier', UserAttachment::class => 'user']; |
242 | 242 | |
243 | - $path = $this->base_path . DIRECTORY_SEPARATOR . $mapping[get_class($attachment)] . DIRECTORY_SEPARATOR . $attachment->getElement()->getID(); |
|
243 | + $path = $this->base_path.DIRECTORY_SEPARATOR.$mapping[get_class($attachment)].DIRECTORY_SEPARATOR.$attachment->getElement()->getID(); |
|
244 | 244 | return $path; |
245 | 245 | } |
246 | 246 | |
@@ -262,17 +262,17 @@ discard block |
||
262 | 262 | //Sanatize filename |
263 | 263 | $originalFilename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME); |
264 | 264 | $safeFilename = transliterator_transliterate('Any-Latin; Latin-ASCII; [^A-Za-z0-9_] remove; Lower()', $originalFilename); |
265 | - $newFilename = $safeFilename . '.' . $file->getClientOriginalExtension(); |
|
265 | + $newFilename = $safeFilename.'.'.$file->getClientOriginalExtension(); |
|
266 | 266 | |
267 | 267 | //If a file with this name is already existing add a number to the filename |
268 | - if (file_exists($folder . DIRECTORY_SEPARATOR . $newFilename)) { |
|
268 | + if (file_exists($folder.DIRECTORY_SEPARATOR.$newFilename)) { |
|
269 | 269 | $bak = $newFilename; |
270 | 270 | |
271 | 271 | $number = 1; |
272 | - $newFilename = $folder . DIRECTORY_SEPARATOR . $safeFilename . '-' . $number . '.' . $file->getClientOriginalExtension(); |
|
272 | + $newFilename = $folder.DIRECTORY_SEPARATOR.$safeFilename.'-'.$number.'.'.$file->getClientOriginalExtension(); |
|
273 | 273 | while (file_exists($newFilename)) { |
274 | 274 | $number++; |
275 | - $newFilename = $folder . DIRECTORY_SEPARATOR . $safeFilename . '-' . $number . '.' . $file->getClientOriginalExtension(); |
|
275 | + $newFilename = $folder.DIRECTORY_SEPARATOR.$safeFilename.'-'.$number.'.'.$file->getClientOriginalExtension(); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $attachments = $form['attachments']; |
102 | 102 | foreach ($attachments as $attachment) { |
103 | 103 | /** @var $attachment FormInterface */ |
104 | - $this->attachmentHelper->upload( $attachment->getData(), $attachment['file']->getData()); |
|
104 | + $this->attachmentHelper->upload($attachment->getData(), $attachment['file']->getData()); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $em->persist($entity); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | //Rebuild form, so it is based on the updated data. Important for the parent field! |
112 | 112 | //We can not use dynamic form events here, because the parent entity list is build from database! |
113 | 113 | $form = $this->createForm($this->form_class, $entity, ['attachment_class' => $this->attachment_class]); |
114 | - } elseif ($form->isSubmitted() && ! $form->isValid()) { |
|
114 | + } elseif ($form->isSubmitted() && !$form->isValid()) { |
|
115 | 115 | $this->addFlash('error', $this->translator->trans('entity.edit_flash.invalid')); |
116 | 116 | } |
117 | 117 | |
@@ -146,17 +146,17 @@ discard block |
||
146 | 146 | $attachments = $form['attachments']; |
147 | 147 | foreach ($attachments as $attachment) { |
148 | 148 | /** @var $attachment FormInterface */ |
149 | - $this->attachmentHelper->upload( $attachment->getData(), $attachment['file']->getData()); |
|
149 | + $this->attachmentHelper->upload($attachment->getData(), $attachment['file']->getData()); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | $em->persist($new_entity); |
153 | 153 | $em->flush(); |
154 | 154 | $this->addFlash('success', $this->translator->trans('entity.created_flash')); |
155 | 155 | |
156 | - return $this->redirectToRoute($this->route_base . '_edit', ['id' => $new_entity->getID()]); |
|
156 | + return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]); |
|
157 | 157 | } |
158 | 158 | |
159 | - if ($form->isSubmitted() && ! $form->isValid()) { |
|
159 | + if ($form->isSubmitted() && !$form->isValid()) { |
|
160 | 160 | $this->addFlash('error', $this->translator->trans('entity.created_flash.invalid')); |
161 | 161 | } |
162 | 162 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | foreach ($errors as $name => $error) { |
178 | 178 | /** @var $error ConstraintViolationList */ |
179 | - $this->addFlash('error', $name . ':' . $error); |
|
179 | + $this->addFlash('error', $name.':'.$error); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | //Show errors to user: |
196 | 196 | foreach ($errors as $name => $error) { |
197 | 197 | /** @var $error ConstraintViolationList */ |
198 | - $this->addFlash('error', $name . ':' . $error); |
|
198 | + $this->addFlash('error', $name.':'.$error); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $this->addFlash('success', 'attachment_type.deleted'); |
240 | 240 | } |
241 | 241 | |
242 | - return $this->redirectToRoute($this->route_base . '_new'); |
|
242 | + return $this->redirectToRoute($this->route_base.'_new'); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | protected function _exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request) |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | $entities = $em->getRepository($this->entity_class)->findAll(); |
252 | 252 | |
253 | - return $exporter->exportEntityFromRequest($entities,$request); |
|
253 | + return $exporter->exportEntityFromRequest($entities, $request); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | protected function _exportEntity(NamedDBElement $entity, EntityExporter $exporter, Request $request) |