@@ -63,12 +63,12 @@ |
||
63 | 63 | |
64 | 64 | $resolver->setRequired('property'); |
65 | 65 | |
66 | - $resolver->setDefault('field', function (Options $option) { |
|
66 | + $resolver->setDefault('field', function(Options $option) { |
|
67 | 67 | return $option['property'].'.name'; |
68 | 68 | }); |
69 | 69 | |
70 | - $resolver->setDefault('render', function (Options $options) { |
|
71 | - return function ($value, Part $context) use ($options) { |
|
70 | + $resolver->setDefault('render', function(Options $options) { |
|
71 | + return function($value, Part $context) use ($options) { |
|
72 | 72 | /** @var AbstractDBElement|null $entity */ |
73 | 73 | $entity = $this->accessor->getValue($context, $options['property']); |
74 | 74 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | //Check if a user has set a preferred language setting: |
64 | 64 | $user = $this->getUser(); |
65 | - if (($user instanceof User) && ! empty($user->getLanguage())) { |
|
65 | + if (($user instanceof User) && !empty($user->getLanguage())) { |
|
66 | 66 | $locale = $user->getLanguage(); |
67 | 67 | } |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $new_url = $request->getUriForPath('/'.$locale.$request->getPathInfo()); |
71 | 71 | |
72 | 72 | //If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string |
73 | - if (($this->enforce_index_php || ! $this->checkIfModRewriteAvailable()) |
|
73 | + if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable()) |
|
74 | 74 | && false === strpos($new_url, 'index.php')) { |
75 | 75 | //Like Request::getUriForPath only with index.php |
76 | 76 | $new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo(); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function checkIfModRewriteAvailable(): bool |
90 | 90 | { |
91 | - if (! function_exists('apache_get_modules')) { |
|
91 | + if (!function_exists('apache_get_modules')) { |
|
92 | 92 | //If we can not check for apache modules, we just hope for the best and assume url rewriting is available |
93 | 93 | //If you want to enforce index.php versions of the url, you can override this via ENV vars. |
94 | 94 | return true; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | 'attr' => [ |
95 | 95 | 'placeholder' => 'user.username.placeholder', |
96 | 96 | ], |
97 | - 'disabled' => ! $this->security->isGranted('edit_username', $entity), |
|
97 | + 'disabled' => !$this->security->isGranted('edit_username', $entity), |
|
98 | 98 | ]) |
99 | 99 | |
100 | 100 | ->add('group', StructuralEntityType::class, [ |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'required' => false, |
103 | 103 | 'label' => 'group.label', |
104 | 104 | 'disable_not_selectable' => true, |
105 | - 'disabled' => ! $this->security->isGranted('change_group', $entity), |
|
105 | + 'disabled' => !$this->security->isGranted('change_group', $entity), |
|
106 | 106 | ]) |
107 | 107 | |
108 | 108 | ->add('first_name', TextType::class, [ |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'placeholder' => 'user.firstName.placeholder', |
113 | 113 | ], |
114 | 114 | 'required' => false, |
115 | - 'disabled' => ! $this->security->isGranted('edit_infos', $entity), |
|
115 | + 'disabled' => !$this->security->isGranted('edit_infos', $entity), |
|
116 | 116 | ]) |
117 | 117 | |
118 | 118 | ->add('last_name', TextType::class, [ |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'placeholder' => 'user.lastName.placeholder', |
123 | 123 | ], |
124 | 124 | 'required' => false, |
125 | - 'disabled' => ! $this->security->isGranted('edit_infos', $entity), |
|
125 | + 'disabled' => !$this->security->isGranted('edit_infos', $entity), |
|
126 | 126 | ]) |
127 | 127 | |
128 | 128 | ->add('email', TextType::class, [ |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | 'placeholder' => 'user.email.placeholder', |
133 | 133 | ], |
134 | 134 | 'required' => false, |
135 | - 'disabled' => ! $this->security->isGranted('edit_infos', $entity), |
|
135 | + 'disabled' => !$this->security->isGranted('edit_infos', $entity), |
|
136 | 136 | ]) |
137 | 137 | |
138 | 138 | ->add('department', TextType::class, [ |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | 'placeholder' => 'user.department.placeholder', |
143 | 143 | ], |
144 | 144 | 'required' => false, |
145 | - 'disabled' => ! $this->security->isGranted('edit_infos', $entity), |
|
145 | + 'disabled' => !$this->security->isGranted('edit_infos', $entity), |
|
146 | 146 | ]) |
147 | 147 | |
148 | 148 | //Config section |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | 'placeholder' => 'user_settings.language.placeholder', |
156 | 156 | 'label' => 'user.language_select', |
157 | 157 | 'preferred_choices' => ['en', 'de'], |
158 | - 'disabled' => ! $this->security->isGranted('change_user_settings', $entity), |
|
158 | + 'disabled' => !$this->security->isGranted('change_user_settings', $entity), |
|
159 | 159 | ]) |
160 | 160 | ->add('timezone', TimezoneType::class, [ |
161 | 161 | 'required' => false, |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | 'placeholder' => 'user_settings.timezone.placeholder', |
167 | 167 | 'label' => 'user.timezone.label', |
168 | 168 | 'preferred_choices' => ['Europe/Berlin'], |
169 | - 'disabled' => ! $this->security->isGranted('change_user_settings', $entity), |
|
169 | + 'disabled' => !$this->security->isGranted('change_user_settings', $entity), |
|
170 | 170 | ]) |
171 | 171 | ->add('theme', ChoiceType::class, [ |
172 | 172 | 'required' => false, |
173 | 173 | 'choices' => User::AVAILABLE_THEMES, |
174 | - 'choice_label' => function ($entity, $key, $value) { |
|
174 | + 'choice_label' => function($entity, $key, $value) { |
|
175 | 175 | return $value; |
176 | 176 | }, |
177 | 177 | 'attr' => [ |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | ], |
180 | 180 | 'placeholder' => 'user_settings.theme.placeholder', |
181 | 181 | 'label' => 'user.theme.label', |
182 | - 'disabled' => ! $this->security->isGranted('change_user_settings', $entity), |
|
182 | + 'disabled' => !$this->security->isGranted('change_user_settings', $entity), |
|
183 | 183 | ]) |
184 | 184 | ->add('currency', CurrencyEntityType::class, [ |
185 | 185 | 'required' => false, |
186 | 186 | 'label' => 'user.currency.label', |
187 | - 'disabled' => ! $this->security->isGranted('change_user_settings', $entity), |
|
187 | + 'disabled' => !$this->security->isGranted('change_user_settings', $entity), |
|
188 | 188 | ]) |
189 | 189 | |
190 | 190 | ->add('new_password', RepeatedType::class, [ |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'invalid_message' => 'password_must_match', |
199 | 199 | 'required' => false, |
200 | 200 | 'mapped' => false, |
201 | - 'disabled' => ! $this->security->isGranted('set_password', $entity), |
|
201 | + 'disabled' => !$this->security->isGranted('set_password', $entity), |
|
202 | 202 | 'constraints' => [new Length([ |
203 | 203 | 'min' => 6, |
204 | 204 | 'max' => 128, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | 'class' => 'checkbox-custom', |
212 | 212 | ], |
213 | 213 | 'label' => 'user.edit.needs_pw_change', |
214 | - 'disabled' => ! $this->security->isGranted('set_password', $entity), |
|
214 | + 'disabled' => !$this->security->isGranted('set_password', $entity), |
|
215 | 215 | ]) |
216 | 216 | |
217 | 217 | ->add('disabled', CheckboxType::class, [ |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | 'class' => 'checkbox-custom', |
221 | 221 | ], |
222 | 222 | 'label' => 'user.edit.user_disabled', |
223 | - 'disabled' => ! $this->security->isGranted('set_password', $entity) |
|
223 | + 'disabled' => !$this->security->isGranted('set_password', $entity) |
|
224 | 224 | || $entity === $this->security->getUser(), |
225 | 225 | ]) |
226 | 226 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | ->add('permissions', PermissionsType::class, [ |
229 | 229 | 'mapped' => false, |
230 | 230 | 'data' => $builder->getData(), |
231 | - 'disabled' => ! $this->security->isGranted('edit_permissions', $entity), |
|
231 | + 'disabled' => !$this->security->isGranted('edit_permissions', $entity), |
|
232 | 232 | ]) |
233 | 233 | ; |
234 | 234 | /*->add('comment', CKEditorType::class, ['required' => false, |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | 'data_class' => $options['attachment_class'], |
248 | 248 | ], |
249 | 249 | 'by_reference' => false, |
250 | - 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity), |
|
250 | + 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), |
|
251 | 251 | ]); |
252 | 252 | |
253 | 253 | $builder->add('log_comment', TextType::class, [ |
@@ -85,7 +85,7 @@ |
||
85 | 85 | */ |
86 | 86 | protected function instanceToPermissionName($subject): ?string |
87 | 87 | { |
88 | - if (! is_string($subject)) { |
|
88 | + if (!is_string($subject)) { |
|
89 | 89 | $class_name = get_class($subject); |
90 | 90 | } else { |
91 | 91 | $class_name = $subject; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $optionsResolver->setAllowedTypes('search', ['null', 'string']); |
114 | 114 | |
115 | 115 | //Configure search options |
116 | - $optionsResolver->setDefault('search_options', function (OptionsResolver $resolver): void { |
|
116 | + $optionsResolver->setDefault('search_options', function(OptionsResolver $resolver): void { |
|
117 | 117 | $resolver->setDefaults([ |
118 | 118 | 'name' => true, |
119 | 119 | 'category' => true, |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $dataTable |
150 | 150 | ->add('picture', TextColumn::class, [ |
151 | 151 | 'label' => '', |
152 | - 'render' => function ($value, Part $context) { |
|
152 | + 'render' => function($value, Part $context) { |
|
153 | 153 | $preview_attachment = $this->previewGenerator->getTablePreviewAttachment($context); |
154 | 154 | if (null === $preview_attachment) { |
155 | 155 | return ''; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | ]) |
167 | 167 | ->add('name', TextColumn::class, [ |
168 | 168 | 'label' => $this->translator->trans('part.table.name'), |
169 | - 'render' => function ($value, Part $context) { |
|
169 | + 'render' => function($value, Part $context) { |
|
170 | 170 | return sprintf( |
171 | 171 | '<a href="%s">%s</a>', |
172 | 172 | $this->urlGenerator->infoURL($context), |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ]) |
196 | 196 | ->add('storelocation', TextColumn::class, [ |
197 | 197 | 'label' => $this->translator->trans('part.table.storeLocations'), |
198 | - 'render' => function ($value, Part $context) { |
|
198 | + 'render' => function($value, Part $context) { |
|
199 | 199 | $tmp = []; |
200 | 200 | foreach ($context->getPartLots() as $lot) { |
201 | 201 | //Ignore lots without storelocation |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ]) |
215 | 215 | ->add('amount', TextColumn::class, [ |
216 | 216 | 'label' => $this->translator->trans('part.table.amount'), |
217 | - 'render' => function ($value, Part $context) { |
|
217 | + 'render' => function($value, Part $context) { |
|
218 | 218 | $amount = $context->getAmountSum(); |
219 | 219 | |
220 | 220 | return $this->amountFormatter->format($amount, $context->getPartUnit()); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ->add('minamount', TextColumn::class, [ |
224 | 224 | 'label' => $this->translator->trans('part.table.minamount'), |
225 | 225 | 'visible' => false, |
226 | - 'render' => function ($value, Part $context) { |
|
226 | + 'render' => function($value, Part $context) { |
|
227 | 227 | return $this->amountFormatter->format($value, $context->getPartUnit()); |
228 | 228 | }, |
229 | 229 | ]) |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | ->addOrderBy('name') |
288 | 288 | ->createAdapter(FetchJoinORMAdapter::class, [ |
289 | 289 | 'simple_total_query' => true, |
290 | - 'query' => function (QueryBuilder $builder): void { |
|
290 | + 'query' => function(QueryBuilder $builder): void { |
|
291 | 291 | $this->getQuery($builder); |
292 | 292 | }, |
293 | 293 | 'entity' => Part::class, |
294 | 294 | 'criteria' => [ |
295 | - function (QueryBuilder $builder) use ($options): void { |
|
295 | + function(QueryBuilder $builder) use ($options): void { |
|
296 | 296 | $this->buildCriteria($builder, $options); |
297 | 297 | }, |
298 | 298 | new SearchCriteriaProvider(), |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | $builder->andWhere('part.tags LIKE :tag')->setParameter('tag', '%'.$options['tag'].'%'); |
376 | 376 | } |
377 | 377 | |
378 | - if (! empty($options['search'])) { |
|
379 | - if (! $options['search_options']['regex']) { |
|
378 | + if (!empty($options['search'])) { |
|
379 | + if (!$options['search_options']['regex']) { |
|
380 | 380 | //Dont show results, if no things are selected |
381 | 381 | $builder->andWhere('0=1'); |
382 | 382 | $defined = false; |
@@ -66,7 +66,7 @@ |
||
66 | 66 | return ''; |
67 | 67 | } |
68 | 68 | |
69 | - $disabled = ! $this->security->isGranted('revert_element', $context->getTargetClass()); |
|
69 | + $disabled = !$this->security->isGranted('revert_element', $context->getTargetClass()); |
|
70 | 70 | |
71 | 71 | $tmp = '<div class="btn-group btn-group-sm">'; |
72 | 72 | $tmp .= sprintf( |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | //When user change its settings, he should be logged in fully. |
85 | 85 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
86 | 86 | |
87 | - if (! $user instanceof User) { |
|
87 | + if (!$user instanceof User) { |
|
88 | 88 | return new RuntimeException('This controller only works only for Part-DB User objects!'); |
89 | 89 | } |
90 | 90 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | //When user change its settings, he should be logged in fully. |
116 | 116 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
117 | 117 | |
118 | - if (! $user instanceof User) { |
|
118 | + if (!$user instanceof User) { |
|
119 | 119 | throw new RuntimeException('This controller only works only for Part-DB User objects!'); |
120 | 120 | } |
121 | 121 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | //When user change its settings, he should be logged in fully. |
167 | 167 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
168 | 168 | |
169 | - if (! $user instanceof User) { |
|
169 | + if (!$user instanceof User) { |
|
170 | 170 | return new RuntimeException('This controller only works only for Part-DB User objects!'); |
171 | 171 | } |
172 | 172 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | //When user change its settings, he should be logged in fully. |
197 | 197 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
198 | 198 | |
199 | - if (! $user instanceof User) { |
|
199 | + if (!$user instanceof User) { |
|
200 | 200 | throw new RuntimeException('This controller only works only for Part-DB User objects!'); |
201 | 201 | } |
202 | 202 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | $form->handleRequest($request); |
210 | 210 | |
211 | - if (! $this->demo_mode && $form->isSubmitted() && $form->isValid()) { |
|
211 | + if (!$this->demo_mode && $form->isSubmitted() && $form->isValid()) { |
|
212 | 212 | //Check if user theme setting has changed |
213 | 213 | if ($user->getTheme() !== $em->getUnitOfWork()->getOriginalEntityData($user)['theme']) { |
214 | 214 | $page_need_reload = true; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $pw_form->handleRequest($request); |
269 | 269 | |
270 | 270 | //Check if password if everything was correct, then save it to User and DB |
271 | - if (! $this->demo_mode && $pw_form->isSubmitted() && $pw_form->isValid()) { |
|
271 | + if (!$this->demo_mode && $pw_form->isSubmitted() && $pw_form->isValid()) { |
|
272 | 272 | $password = $passwordEncoder->encodePassword($user, $pw_form['new_password']->getData()); |
273 | 273 | $user->setPassword($password); |
274 | 274 | |
@@ -283,14 +283,14 @@ discard block |
||
283 | 283 | //Handle 2FA things |
284 | 284 | $google_form = $this->createForm(TFAGoogleSettingsType::class, $user); |
285 | 285 | $google_enabled = $user->isGoogleAuthenticatorEnabled(); |
286 | - if (! $google_enabled && ! $form->isSubmitted()) { |
|
286 | + if (!$google_enabled && !$form->isSubmitted()) { |
|
287 | 287 | $user->setGoogleAuthenticatorSecret($googleAuthenticator->generateSecret()); |
288 | 288 | $google_form->get('googleAuthenticatorSecret')->setData($user->getGoogleAuthenticatorSecret()); |
289 | 289 | } |
290 | 290 | $google_form->handleRequest($request); |
291 | 291 | |
292 | - if (! $this->demo_mode && $google_form->isSubmitted() && $google_form->isValid()) { |
|
293 | - if (! $google_enabled) { |
|
292 | + if (!$this->demo_mode && $google_form->isSubmitted() && $google_form->isValid()) { |
|
293 | + if (!$google_enabled) { |
|
294 | 294 | //Save 2FA settings (save secrets) |
295 | 295 | $user->setGoogleAuthenticatorSecret($google_form->get('googleAuthenticatorSecret')->getData()); |
296 | 296 | $backupCodeManager->enableBackupCodes($user); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | ])->getForm(); |
319 | 319 | |
320 | 320 | $backup_form->handleRequest($request); |
321 | - if (! $this->demo_mode && $backup_form->isSubmitted() && $backup_form->isValid()) { |
|
321 | + if (!$this->demo_mode && $backup_form->isSubmitted() && $backup_form->isValid()) { |
|
322 | 322 | $backupCodeManager->regenerateBackupCodes($user); |
323 | 323 | $em->flush(); |
324 | 324 | $this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated'); |
@@ -146,7 +146,7 @@ |
||
146 | 146 | $this->dbRepository->changeID($element, $logEntry->getTargetID()); |
147 | 147 | } |
148 | 148 | |
149 | - if (! $element instanceof AbstractDBElement) { |
|
149 | + if (!$element instanceof AbstractDBElement) { |
|
150 | 150 | $this->addFlash('error', 'log.undo.target_not_found'); |
151 | 151 | |
152 | 152 | return; |
@@ -119,7 +119,7 @@ |
||
119 | 119 | |
120 | 120 | public function hasOldDataInformations(): bool |
121 | 121 | { |
122 | - return ! empty($this->extra['d']); |
|
122 | + return !empty($this->extra['d']); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | public function getOldData(): array |