Passed
Push — master ( ad949d...7f3b40 )
by Jan
05:20
created
src/Controller/AdminPages/BaseAdminController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             //Rebuild form, so it is based on the updated data. Important for the parent field!
81 81
             //We can not use dynamic form events here, because the parent entity list is build from database!
82 82
             $form = $this->createForm($this->form_class, $entity);
83
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
83
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
84 84
             $this->addFlash('error', $this->translator->trans('entity.edit_flash.invalid'));
85 85
         }
86 86
 
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
             $em->flush();
108 108
             $this->addFlash('success', $this->translator->trans('entity.created_flash'));
109 109
 
110
-            return $this->redirectToRoute($this->route_base . '_edit', ['id' => $new_entity->getID()]);
111
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
110
+            return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]);
111
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
112 112
             $this->addFlash('error', $this->translator->trans('entity.created_flash.invalid'));
113 113
         }
114 114
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
             foreach ($errors as $name => $error) {
130 130
                 /** @var $error ConstraintViolationList */
131
-                $this->addFlash('error', $name . ':' . $error);
131
+                $this->addFlash('error', $name.':'.$error);
132 132
             }
133 133
         }
134 134
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             //Show errors to user:
148 148
             foreach ($errors as $name => $error) {
149 149
                 /** @var $error ConstraintViolationList */
150
-                $this->addFlash('error', $name . ':' . $error);
150
+                $this->addFlash('error', $name.':'.$error);
151 151
             }
152 152
         }
153 153
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             $this->addFlash('success', 'attachment_type.deleted');
189 189
         }
190 190
 
191
-        return $this->redirectToRoute($this->route_base .  '_new');
191
+        return $this->redirectToRoute($this->route_base.'_new');
192 192
     }
193 193
 
194 194
     protected function _exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
         $entities = $em->getRepository($this->entity_class)->findAll();
201 201
 
202
-        return $exporter->exportEntityFromRequest($entities,$request);
202
+        return $exporter->exportEntityFromRequest($entities, $request);
203 203
     }
204 204
 
205 205
     protected function _exportEntity(NamedDBElement $entity, EntityExporter $exporter, Request $request)
Please login to merge, or discard this patch.
src/Form/Part/PartBaseType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             ->add('description', CKEditorType::class, ['required' => false, 'empty_data' => '',
78 78
                 'label' => 'description.label', 'help' => 'bbcode.hint', 'config_name' => 'description_config',
79 79
                 'attr' => ['placeholder' => 'part.description.placeholder', 'rows' => 2],
80
-                'disabled' => !$this->security->isGranted('description.edit', $part) ])
80
+                'disabled' => !$this->security->isGranted('description.edit', $part)])
81 81
             ->add('minAmount', SIUnitType::class,
82 82
                 ['attr' => ['min' => 0, 'placeholder' => 'part.mininstock.placeholder'], 'label' => 'mininstock.label',
83 83
                     'measurement_unit' => $part->getPartUnit(),
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 'disabled' => !$this->security->isGranted('move', $part), ])
91 91
             ->add('tags', TextType::class, ['required' => false, 'label' => 'part.tags', 'empty_data' => "",
92 92
                 'attr' => ['data-role' => 'tagsinput'],
93
-                'disabled' => !$this->security->isGranted('edit', $part) ]);
93
+                'disabled' => !$this->security->isGranted('edit', $part)]);
94 94
 
95 95
         //Manufacturer section
96 96
         $builder->add('manufacturer', StructuralEntityType::class, ['class' => Manufacturer::class,
Please login to merge, or discard this patch.
src/Services/AmountFormatter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     protected function configureOptions(OptionsResolver $resolver)
53 53
     {
54 54
         $resolver->setDefaults([
55
-            'show_prefix' => function (Options $options) {
55
+            'show_prefix' => function(Options $options) {
56 56
                 if ($options['measurement_unit'] !== null) {
57 57
                     /** @var MeasurementUnit $unit */
58 58
                     $unit = $options['measurement_unit'];
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                 }
61 61
                 return true;
62 62
             },
63
-            'is_integer' => function (Options $options) {
63
+            'is_integer' => function(Options $options) {
64 64
                 if ($options['measurement_unit'] !== null) {
65 65
                     /** @var MeasurementUnit $unit */
66 66
                     $unit = $options['measurement_unit'];
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 }
69 69
                 return true;
70 70
             },
71
-            'unit' => function (Options $options) {
71
+            'unit' => function(Options $options) {
72 72
                 if ($options['measurement_unit'] !== null) {
73 73
                     /** @var MeasurementUnit $unit */
74 74
                     $unit = $options['measurement_unit'];
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
                 return '';
78 78
             },
79 79
             'decimals' => 2,
80
-            'error_mapping' => [ '.' => 'value']
80
+            'error_mapping' => ['.' => 'value']
81 81
         ]);
82 82
 
83 83
         $resolver->setAllowedTypes('decimals', 'int');
84 84
 
85
-        $resolver->setNormalizer('decimals', function (Options $options, $value) {
85
+        $resolver->setNormalizer('decimals', function(Options $options, $value) {
86 86
             // If the unit is integer based, then dont show any decimals
87 87
             if ($options['is_integer']) {
88 88
                 return 0;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         }
126 126
 
127 127
         //Otherwise just output it
128
-        $format_string = '%.' . $options['decimals'] . 'f ' . $options['unit'];
128
+        $format_string = '%.'.$options['decimals'].'f '.$options['unit'];
129 129
         return sprintf($format_string, $value);
130 130
     }
131 131
 }
132 132
\ No newline at end of file
Please login to merge, or discard this patch.
src/Form/Type/SIUnitType.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $resolver->setDefaults([
60 60
             'measurement_unit' => null,
61
-            'show_prefix' => function (Options $options) {
61
+            'show_prefix' => function(Options $options) {
62 62
                 if ($options['measurement_unit'] !== null) {
63 63
                     /** @var MeasurementUnit $unit */
64 64
                     $unit = $options['measurement_unit'];
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                 }
67 67
                 return false;
68 68
             },
69
-            'is_integer' => function (Options $options) {
69
+            'is_integer' => function(Options $options) {
70 70
                 if ($options['measurement_unit'] !== null) {
71 71
                     /** @var MeasurementUnit $unit */
72 72
                     $unit = $options['measurement_unit'];
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 }
75 75
                 return false;
76 76
             },
77
-            'unit' => function (Options $options) {
77
+            'unit' => function(Options $options) {
78 78
                 if ($options['measurement_unit'] !== null) {
79 79
                     /** @var MeasurementUnit $unit */
80 80
                     $unit = $options['measurement_unit'];
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 }
83 83
                 return null;
84 84
             },
85
-            'error_mapping' => [ '.' => 'value']
85
+            'error_mapping' => ['.' => 'value']
86 86
         ]);
87 87
 
88 88
         $resolver->setAllowedTypes('measurement_unit', [MeasurementUnit::class, 'null']);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $resolver->setDefaults([
93 93
                 'min' => 0,
94 94
                 'max' => '',
95
-                'step' => function (Options $options) {
95
+                'step' => function(Options $options) {
96 96
                     if ($options['is_integer'] === true) {
97 97
                         return 1;
98 98
                     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
         if ($options['show_prefix']) {
119 119
             $builder->add('prefix', ChoiceType::class, [
120
-                'choices' => ['M' => 6, 'k' => 3, '' => 0, 'm' => -3, 'µ' => -6 ]
120
+                'choices' => ['M' => 6, 'k' => 3, '' => 0, 'm' => -3, 'µ' => -6]
121 121
             ]);
122 122
         }
123 123
 
Please login to merge, or discard this patch.
src/Services/AttachmentHelper.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         if ($fs->isAbsolutePath($tmp_base_path)) {
58 58
             $this->base_path = $tmp_base_path;
59 59
         } else {
60
-            $this->base_path = realpath($kernel->getProjectDir() . DIRECTORY_SEPARATOR . $tmp_base_path);
60
+            $this->base_path = realpath($kernel->getProjectDir().DIRECTORY_SEPARATOR.$tmp_base_path);
61 61
         }
62 62
     }
63 63
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
         $sz = 'BKMGTP';
161 161
         $factor = (int) floor((strlen($bytes) - 1) / 3);
162
-        return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor) . @$sz[$factor];
162
+        return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor).@$sz[$factor];
163 163
     }
164 164
 
165 165
     /**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $mapping = [PartAttachment::class => 'part'];
173 173
 
174
-        $path = $this->base_path . DIRECTORY_SEPARATOR . $mapping[get_class($attachment)] . DIRECTORY_SEPARATOR . $attachment->getElement()->getID();
174
+        $path = $this->base_path.DIRECTORY_SEPARATOR.$mapping[get_class($attachment)].DIRECTORY_SEPARATOR.$attachment->getElement()->getID();
175 175
         return $path;
176 176
     }
177 177
 
@@ -193,17 +193,17 @@  discard block
 block discarded – undo
193 193
         //Sanatize filename
194 194
         $originalFilename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
195 195
         $safeFilename = transliterator_transliterate('Any-Latin; Latin-ASCII; [^A-Za-z0-9_] remove; Lower()', $originalFilename);
196
-        $newFilename = $safeFilename . '.' . $file->getClientOriginalExtension();
196
+        $newFilename = $safeFilename.'.'.$file->getClientOriginalExtension();
197 197
 
198 198
         //If a file with this name is already existing add a number to the filename
199
-        if (file_exists($folder . DIRECTORY_SEPARATOR . $newFilename)) {
199
+        if (file_exists($folder.DIRECTORY_SEPARATOR.$newFilename)) {
200 200
             $bak = $newFilename;
201 201
 
202 202
             $number = 1;
203
-            $newFilename = $folder . DIRECTORY_SEPARATOR . $safeFilename . '-' . $number . '.' . $file->getClientOriginalExtension();
203
+            $newFilename = $folder.DIRECTORY_SEPARATOR.$safeFilename.'-'.$number.'.'.$file->getClientOriginalExtension();
204 204
             while (file_exists($newFilename)) {
205 205
                 $number++;
206
-                $newFilename = $folder . DIRECTORY_SEPARATOR . $safeFilename . '-' . $number . '.' . $file->getClientOriginalExtension();
206
+                $newFilename = $folder.DIRECTORY_SEPARATOR.$safeFilename.'-'.$number.'.'.$file->getClientOriginalExtension();
207 207
             }
208 208
         }
209 209
 
Please login to merge, or discard this patch.
src/Controller/PartController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             $attachments = $form['attachments'];
86 86
             foreach ($attachments as $attachment) {
87 87
                 /** @var $attachment FormInterface */
88
-                $attachmentHelper->upload( $attachment->getData(), $attachment['file']->getData());
88
+                $attachmentHelper->upload($attachment->getData(), $attachment['file']->getData());
89 89
             }
90 90
 
91 91
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             $this->addFlash('info', $translator->trans('part.edited_flash'));
95 95
             //Reload form, so the SIUnitType entries use the new part unit
96 96
             $form = $this->createForm(PartBaseType::class, $part);
97
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
97
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
98 98
             $this->addFlash('error', $translator->trans('part.edited_flash.invalid'));
99 99
         }
100 100
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             $attachments = $form['attachments'];
136 136
             foreach ($attachments as $attachment) {
137 137
                 /** @var $attachment FormInterface */
138
-                $attachmentHelper->upload( $attachment->getData(), $attachment['file']->getData());
138
+                $attachmentHelper->upload($attachment->getData(), $attachment['file']->getData());
139 139
             }
140 140
 
141 141
             $em->persist($new_part);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             $this->addFlash('success', $translator->trans('part.created_flash'));
144 144
 
145 145
             return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
146
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
146
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
147 147
             $this->addFlash('error', $translator->trans('part.created_flash.invalid'));
148 148
         }
149 149
 
Please login to merge, or discard this patch.