Passed
Push — master ( 5cc08a...d32ced )
by Jan
04:37
created
src/Form/Type/StructuralEntityType.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
     public function buildForm(FormBuilderInterface $builder, array $options)
75 75
     {
76 76
         $builder->addModelTransformer(new CallbackTransformer(
77
-            function ($value) use ($options){
77
+            function($value) use ($options){
78 78
                 return $this->transform($value, $options);
79
-            }, function ($value) use ($options) {
79
+            }, function($value) use ($options) {
80 80
                 return $this->reverseTransform($value, $options);
81 81
         }));
82 82
     }
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
         $resolver->setRequired(['class']);
87 87
         $resolver->setDefaults(['attr' => ['class' => 'selectpicker', 'data-live-search' => true],
88 88
             'show_fullpath_in_subtext' => true, //When this is enabled, the full path will be shown in subtext
89
-            'subentities_of' => null,   //Only show entities with the given parent class
90
-            'disable_not_selectable' => false,  //Disable entries with not selectable property
89
+            'subentities_of' => null, //Only show entities with the given parent class
90
+            'disable_not_selectable' => false, //Disable entries with not selectable property
91 91
             'choice_value' => 'id', //Use the element id as option value and for comparing items
92
-            'choice_loader' => function (Options $options) {
93
-                return new CallbackChoiceLoader(function () use ($options) {
92
+            'choice_loader' => function(Options $options) {
93
+                return new CallbackChoiceLoader(function() use ($options) {
94 94
                     return $this->getEntries($options);
95 95
                 });
96
-            }, 'choice_label' => function ($choice, $key, $value) {
96
+            }, 'choice_label' => function($choice, $key, $value) {
97 97
                 return $this->generateChoiceLabels($choice, $key, $value);
98
-            }, 'choice_attr' => function ($choice, $key, $value) {
98
+            }, 'choice_attr' => function($choice, $key, $value) {
99 99
                 return $this->generateChoiceAttr($choice, $key, $value);
100 100
             }
101 101
         ]);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 
132 132
         $tmp = str_repeat('   ', $choice->getLevel()); //Use 3 spaces for intendation
133
-        $tmp .=  htmlspecialchars($choice->getName($parent));
133
+        $tmp .= htmlspecialchars($choice->getName($parent));
134 134
         return $tmp;
135 135
     }
136 136
 
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
@@ -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/Controller/PartController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
             //Reload form, so the SIUnitType entries use the new part unit
86 86
             $form = $this->createForm(PartBaseType::class, $part);
87
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
87
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
88 88
             $this->addFlash('error', $translator->trans('part.edited_flash.invalid'));
89 89
         }
90 90
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             $this->addFlash('success', $translator->trans('part.created_flash'));
125 125
 
126 126
             return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
127
-        } elseif ($form->isSubmitted() && ! $form->isValid()) {
127
+        } elseif ($form->isSubmitted() && !$form->isValid()) {
128 128
             $this->addFlash('error', $translator->trans('part.created_flash.invalid'));
129 129
         }
130 130
 
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 true;
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.