@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | $this->allowedMethods = []; |
62 | 62 | foreach ($methods as $class => $m) { |
63 | - $this->allowedMethods[$class] = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]); |
|
63 | + $this->allowedMethods[$class] = array_map(function($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -77,19 +77,19 @@ discard block |
||
77 | 77 | public function checkSecurity($tags, $filters, $functions): void |
78 | 78 | { |
79 | 79 | foreach ($tags as $tag) { |
80 | - if (! \in_array($tag, $this->allowedTags, true)) { |
|
80 | + if (!\in_array($tag, $this->allowedTags, true)) { |
|
81 | 81 | throw new SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | 85 | foreach ($filters as $filter) { |
86 | - if (! \in_array($filter, $this->allowedFilters, true)) { |
|
86 | + if (!\in_array($filter, $this->allowedFilters, true)) { |
|
87 | 87 | throw new SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | foreach ($functions as $function) { |
92 | - if (! \in_array($function, $this->allowedFunctions, true)) { |
|
92 | + if (!\in_array($function, $this->allowedFunctions, true)) { |
|
93 | 93 | throw new SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function); |
94 | 94 | } |
95 | 95 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - if (! $allowed) { |
|
117 | + if (!$allowed) { |
|
118 | 118 | $class = \get_class($obj); |
119 | 119 | |
120 | 120 | throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | - if (! $allowed) { |
|
138 | + if (!$allowed) { |
|
139 | 139 | $class = \get_class($obj); |
140 | 140 | |
141 | 141 | throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); |
@@ -90,7 +90,7 @@ |
||
90 | 90 | */ |
91 | 91 | public function setContentDisposition($disposition, $filename, $filenameFallback = '') |
92 | 92 | { |
93 | - if ('' === $filenameFallback && (! preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) { |
|
93 | + if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) { |
|
94 | 94 | $encoding = mb_detect_encoding($filename, null, true) ?: '8bit'; |
95 | 95 | |
96 | 96 | for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) { |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | 'class' => 'selectpicker', |
66 | 66 | 'title' => 'selectpicker.nothing_selected', |
67 | 67 | ], |
68 | - 'choice_attr' => function (Options $options) { |
|
69 | - return function ($choice, $key, $value) use ($options) { |
|
68 | + 'choice_attr' => function(Options $options) { |
|
69 | + return function($choice, $key, $value) use ($options) { |
|
70 | 70 | /** @var Attachment $choice */ |
71 | 71 | $tmp = ['data-subtext' => $choice->getFilename() ?? 'URL']; |
72 | 72 | |
73 | - if ('picture' === $options['filter'] && ! $choice->isPicture()) { |
|
73 | + if ('picture' === $options['filter'] && !$choice->isPicture()) { |
|
74 | 74 | $tmp += ['disabled' => 'disabled']; |
75 | - } elseif ('3d_model' === $options['filter'] && ! $choice->is3DModel()) { |
|
75 | + } elseif ('3d_model' === $options['filter'] && !$choice->is3DModel()) { |
|
76 | 76 | $tmp += ['disabled' => 'disabled']; |
77 | 77 | } |
78 | 78 | |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | }; |
81 | 81 | }, |
82 | 82 | 'choice_label' => 'name', |
83 | - 'choice_loader' => function (Options $options) { |
|
84 | - return new CallbackChoiceLoader(function () use ($options) { |
|
83 | + 'choice_loader' => function(Options $options) { |
|
84 | + return new CallbackChoiceLoader(function() use ($options) { |
|
85 | 85 | $entity = $options['entity']; |
86 | - if (! $entity instanceof AttachmentContainingDBElement) { |
|
86 | + if (!$entity instanceof AttachmentContainingDBElement) { |
|
87 | 87 | throw new \RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)'); |
88 | 88 | } |
89 | 89 |
@@ -72,27 +72,27 @@ discard block |
||
72 | 72 | $builder |
73 | 73 | ->add('name', TextType::class, [ |
74 | 74 | 'label' => 'user.username.label', |
75 | - 'disabled' => ! $this->security->isGranted('edit_username', $options['data']) || $this->demo_mode, |
|
75 | + 'disabled' => !$this->security->isGranted('edit_username', $options['data']) || $this->demo_mode, |
|
76 | 76 | ]) |
77 | 77 | ->add('first_name', TextType::class, [ |
78 | 78 | 'required' => false, |
79 | 79 | 'label' => 'user.firstName.label', |
80 | - 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
80 | + 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
81 | 81 | ]) |
82 | 82 | ->add('last_name', TextType::class, [ |
83 | 83 | 'required' => false, |
84 | 84 | 'label' => 'user.lastName.label', |
85 | - 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
85 | + 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
86 | 86 | ]) |
87 | 87 | ->add('department', TextType::class, [ |
88 | 88 | 'required' => false, |
89 | 89 | 'label' => 'user.department.label', |
90 | - 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
90 | + 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
91 | 91 | ]) |
92 | 92 | ->add('email', EmailType::class, [ |
93 | 93 | 'required' => false, |
94 | 94 | 'label' => 'user.email.label', |
95 | - 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
95 | + 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
96 | 96 | ]) |
97 | 97 | ->add('language', LanguageType::class, [ |
98 | 98 | 'disabled' => $this->demo_mode, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ], |
125 | 125 | 'choice_translation_domain' => false, |
126 | 126 | 'choices' => User::AVAILABLE_THEMES, |
127 | - 'choice_label' => function ($entity, $key, $value) { |
|
127 | + 'choice_label' => function($entity, $key, $value) { |
|
128 | 128 | return $value; |
129 | 129 | }, |
130 | 130 | 'placeholder' => 'user_settings.theme.placeholder', |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | foreach ($results as $result) { |
155 | 155 | /** @var AbstractNamedDBElement $result */ |
156 | 156 | $io->writeln( |
157 | - 'Convert entity: '.$result->getName().' (' . get_class($result) . ': ' . $result->getID() . ')', |
|
157 | + 'Convert entity: '.$result->getName().' ('.get_class($result).': '.$result->getID().')', |
|
158 | 158 | OutputInterface::VERBOSITY_VERBOSE |
159 | 159 | ); |
160 | 160 | foreach ($properties as $property) { |
161 | 161 | //Retrieve bbcode from entity |
162 | 162 | $bbcode = $this->propertyAccessor->getValue($result, $property); |
163 | 163 | //Check if the current property really contains BBCode |
164 | - if (! preg_match(static::BBCODE_REGEX, $bbcode)) { |
|
164 | + if (!preg_match(static::BBCODE_REGEX, $bbcode)) { |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | $io->writeln( |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | //If we are not in dry run, save changes to DB |
185 | - if (! $input->getOption('dry-run')) { |
|
185 | + if (!$input->getOption('dry-run')) { |
|
186 | 186 | $this->em->flush(); |
187 | 187 | $io->success('Changes saved to DB successfully!'); |
188 | 188 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | public function getFilters() |
31 | 31 | { |
32 | 32 | return [ |
33 | - new TwigFilter('barcodeSVG', function (string $content, string $type = "QRCODE") { |
|
33 | + new TwigFilter('barcodeSVG', function(string $content, string $type = "QRCODE") { |
|
34 | 34 | $barcodeFactory = new Barcode(); |
35 | 35 | $barcode = $barcodeFactory->getBarcodeObj($type, $content); |
36 | 36 | return $barcode->getSvgCode(); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | ->setParameter(1, $element); |
38 | 38 | |
39 | 39 | foreach ($order_by as $field => $order) { |
40 | - $qb->addOrderBy('part.' . $field, $order); |
|
40 | + $qb->addOrderBy('part.'.$field, $order); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return $qb->getQuery()->getResult(); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | ->setParameter(1, $element); |
38 | 38 | |
39 | 39 | foreach ($order_by as $field => $order) { |
40 | - $qb->addOrderBy('part.' . $field, $order); |
|
40 | + $qb->addOrderBy('part.'.$field, $order); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return $qb->getQuery()->getResult(); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | 'attr' => [ |
105 | 105 | 'placeholder' => 'part.edit.name.placeholder', |
106 | 106 | ], |
107 | - 'disabled' => ! $this->security->isGranted('name.edit', $part), |
|
107 | + 'disabled' => !$this->security->isGranted('name.edit', $part), |
|
108 | 108 | ]) |
109 | 109 | ->add('description', CKEditorType::class, [ |
110 | 110 | 'required' => false, |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | 'placeholder' => 'part.edit.description.placeholder', |
116 | 116 | 'rows' => 2, |
117 | 117 | ], |
118 | - 'disabled' => ! $this->security->isGranted('description.edit', $part), |
|
118 | + 'disabled' => !$this->security->isGranted('description.edit', $part), |
|
119 | 119 | ]) |
120 | 120 | ->add('minAmount', SIUnitType::class, [ |
121 | 121 | 'attr' => [ |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | ], |
125 | 125 | 'label' => 'part.edit.mininstock', |
126 | 126 | 'measurement_unit' => $part->getPartUnit(), |
127 | - 'disabled' => ! $this->security->isGranted('minamount.edit', $part), |
|
127 | + 'disabled' => !$this->security->isGranted('minamount.edit', $part), |
|
128 | 128 | ]) |
129 | 129 | ->add('category', StructuralEntityType::class, [ |
130 | 130 | 'class' => Category::class, |
131 | 131 | 'label' => 'part.edit.category', |
132 | 132 | 'disable_not_selectable' => true, |
133 | - 'disabled' => ! $this->security->isGranted('category.edit', $part), |
|
133 | + 'disabled' => !$this->security->isGranted('category.edit', $part), |
|
134 | 134 | 'constraints' => [ |
135 | 135 | |
136 | 136 | ] |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | 'required' => false, |
141 | 141 | 'label' => 'part.edit.footprint', |
142 | 142 | 'disable_not_selectable' => true, |
143 | - 'disabled' => ! $this->security->isGranted('footprint.edit', $part), |
|
143 | + 'disabled' => !$this->security->isGranted('footprint.edit', $part), |
|
144 | 144 | ]) |
145 | 145 | ->add('tags', TextType::class, [ |
146 | 146 | 'required' => false, |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'class' => 'tagsinput', |
151 | 151 | 'data-autocomplete' => $this->urlGenerator->generate('typeahead_tags', ['query' => 'QUERY']), |
152 | 152 | ], |
153 | - 'disabled' => ! $this->security->isGranted('tags.edit', $part), |
|
153 | + 'disabled' => !$this->security->isGranted('tags.edit', $part), |
|
154 | 154 | ]); |
155 | 155 | |
156 | 156 | //Manufacturer section |
@@ -159,25 +159,25 @@ discard block |
||
159 | 159 | 'required' => false, |
160 | 160 | 'label' => 'part.edit.manufacturer.label', |
161 | 161 | 'disable_not_selectable' => true, |
162 | - 'disabled' => ! $this->security->isGranted('manufacturer.edit', $part), |
|
162 | + 'disabled' => !$this->security->isGranted('manufacturer.edit', $part), |
|
163 | 163 | ]) |
164 | 164 | ->add('manufacturer_product_url', UrlType::class, [ |
165 | 165 | 'required' => false, |
166 | 166 | 'empty_data' => '', |
167 | 167 | 'label' => 'part.edit.manufacturer_url.label', |
168 | - 'disabled' => ! $this->security->isGranted('mpn.edit', $part), |
|
168 | + 'disabled' => !$this->security->isGranted('mpn.edit', $part), |
|
169 | 169 | ]) |
170 | 170 | ->add('manufacturer_product_number', TextType::class, [ |
171 | 171 | 'required' => false, |
172 | 172 | 'empty_data' => '', |
173 | 173 | 'label' => 'part.edit.mpn', |
174 | - 'disabled' => ! $this->security->isGranted('mpn.edit', $part), |
|
174 | + 'disabled' => !$this->security->isGranted('mpn.edit', $part), |
|
175 | 175 | ]) |
176 | 176 | ->add('manufacturing_status', ChoiceType::class, [ |
177 | 177 | 'label' => 'part.edit.manufacturing_status', |
178 | 178 | 'choices' => $status_choices, |
179 | 179 | 'required' => false, |
180 | - 'disabled' => ! $this->security->isGranted('status.edit', $part), |
|
180 | + 'disabled' => !$this->security->isGranted('status.edit', $part), |
|
181 | 181 | ]); |
182 | 182 | |
183 | 183 | //Advanced section |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ], |
188 | 188 | 'required' => false, |
189 | 189 | 'label' => 'part.edit.needs_review', |
190 | - 'disabled' => ! $this->security->isGranted('edit', $part), |
|
190 | + 'disabled' => !$this->security->isGranted('edit', $part), |
|
191 | 191 | ]) |
192 | 192 | ->add('favorite', CheckboxType::class, [ |
193 | 193 | 'label_attr' => [ |
@@ -195,20 +195,20 @@ discard block |
||
195 | 195 | ], |
196 | 196 | 'required' => false, |
197 | 197 | 'label' => 'part.edit.is_favorite', |
198 | - 'disabled' => ! $this->security->isGranted('change_favorite', $part), |
|
198 | + 'disabled' => !$this->security->isGranted('change_favorite', $part), |
|
199 | 199 | ]) |
200 | 200 | ->add('mass', SIUnitType::class, [ |
201 | 201 | 'unit' => 'g', |
202 | 202 | 'label' => 'part.edit.mass', |
203 | 203 | 'required' => false, |
204 | - 'disabled' => ! $this->security->isGranted('mass.edit', $part), |
|
204 | + 'disabled' => !$this->security->isGranted('mass.edit', $part), |
|
205 | 205 | ]) |
206 | 206 | ->add('partUnit', StructuralEntityType::class, [ |
207 | 207 | 'class' => MeasurementUnit::class, |
208 | 208 | 'required' => false, |
209 | 209 | 'disable_not_selectable' => true, |
210 | 210 | 'label' => 'part.edit.partUnit', |
211 | - 'disabled' => ! $this->security->isGranted('unit.edit', $part), |
|
211 | + 'disabled' => !$this->security->isGranted('unit.edit', $part), |
|
212 | 212 | ]); |
213 | 213 | |
214 | 214 | //Comment section |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | 'attr' => [ |
219 | 219 | 'rows' => 4, |
220 | 220 | ], |
221 | - 'disabled' => ! $this->security->isGranted('comment.edit', $part), |
|
221 | + 'disabled' => !$this->security->isGranted('comment.edit', $part), |
|
222 | 222 | 'empty_data' => '', |
223 | 223 | ]); |
224 | 224 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | 'label' => false, |
232 | 232 | 'entry_options' => [ |
233 | 233 | 'measurement_unit' => $part->getPartUnit(), |
234 | - 'disabled' => ! $this->security->isGranted('lots.edit', $part), |
|
234 | + 'disabled' => !$this->security->isGranted('lots.edit', $part), |
|
235 | 235 | ], |
236 | 236 | 'by_reference' => false, |
237 | 237 | ]); |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | 'label' => false, |
246 | 246 | 'entry_options' => [ |
247 | 247 | 'data_class' => PartAttachment::class, |
248 | - 'disabled' => ! $this->security->isGranted('attachments.edit', $part), |
|
248 | + 'disabled' => !$this->security->isGranted('attachments.edit', $part), |
|
249 | 249 | ], |
250 | 250 | 'by_reference' => false, |
251 | 251 | ]); |
252 | 252 | |
253 | 253 | $builder->add('master_picture_attachment', MasterPictureAttachmentType::class, [ |
254 | 254 | 'required' => false, |
255 | - 'disabled' => ! $this->security->isGranted('attachments.edit', $part), |
|
255 | + 'disabled' => !$this->security->isGranted('attachments.edit', $part), |
|
256 | 256 | 'label' => 'part.edit.master_attachment', |
257 | 257 | 'entity' => $part, |
258 | 258 | ]); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | 'prototype_data' => new Orderdetail(), |
269 | 269 | 'entry_options' => [ |
270 | 270 | 'measurement_unit' => $part->getPartUnit(), |
271 | - 'disabled' => ! $this->security->isGranted('orderdetails.edit', $part), |
|
271 | + 'disabled' => !$this->security->isGranted('orderdetails.edit', $part), |
|
272 | 272 | ], |
273 | 273 | ]); |
274 | 274 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | 'by_reference' => false, |
282 | 282 | 'prototype_data' => new PartParameter(), |
283 | 283 | 'entry_options' => [ |
284 | - 'disabled' => ! $this->security->isGranted('parameters.edit', $part), |
|
284 | + 'disabled' => !$this->security->isGranted('parameters.edit', $part), |
|
285 | 285 | 'data_class' => PartParameter::class, |
286 | 286 | ], |
287 | 287 | ]); |