@@ -71,7 +71,7 @@ |
||
71 | 71 | */ |
72 | 72 | public function createNodesForClass(string $class, ObjectManager $manager): void |
73 | 73 | { |
74 | - if (! new $class() instanceof AbstractStructuralDBElement) { |
|
74 | + if (!new $class() instanceof AbstractStructuralDBElement) { |
|
75 | 75 | throw new InvalidArgumentException('$class must be a StructuralDBElement!'); |
76 | 76 | } |
77 | 77 |
@@ -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, [ |
@@ -80,9 +80,9 @@ |
||
80 | 80 | public function onRegister(RegisterEvent $event): void |
81 | 81 | { |
82 | 82 | //Skip adding of U2F key on demo mode |
83 | - if (! $this->demo_mode) { |
|
83 | + if (!$this->demo_mode) { |
|
84 | 84 | $user = $event->getUser(); |
85 | - if (! $user instanceof User) { |
|
85 | + if (!$user instanceof User) { |
|
86 | 86 | throw new \InvalidArgumentException('Only User objects can be registered for U2F!'); |
87 | 87 | } |
88 | 88 |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | { |
270 | 270 | unset($fields['lastModified']); |
271 | 271 | |
272 | - if (! $this->hasFieldRestrictions($element)) { |
|
272 | + if (!$this->hasFieldRestrictions($element)) { |
|
273 | 273 | return $fields; |
274 | 274 | } |
275 | 275 | |
276 | - return array_filter($fields, function ($value, $key) use ($element) { |
|
276 | + return array_filter($fields, function($value, $key) use ($element) { |
|
277 | 277 | //Associative array (save changed data) case |
278 | 278 | if (is_string($key)) { |
279 | 279 | return $this->shouldFieldBeSaved($element, $key); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | { |
288 | 288 | $uow = $em->getUnitOfWork(); |
289 | 289 | |
290 | - if (! $logEntry instanceof ElementEditedLogEntry && ! $logEntry instanceof ElementDeletedLogEntry) { |
|
290 | + if (!$logEntry instanceof ElementEditedLogEntry && !$logEntry instanceof ElementDeletedLogEntry) { |
|
291 | 291 | throw new \InvalidArgumentException('$logEntry must be ElementEditedLogEntry or ElementDeletedLogEntry!'); |
292 | 292 | } |
293 | 293 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $old_data = $this->filterFieldRestrictions($entity, $old_data); |
301 | 301 | |
302 | 302 | //Restrict length of string fields, to save memory... |
303 | - $old_data = array_map(function ($value) { |
|
303 | + $old_data = array_map(function($value) { |
|
304 | 304 | if (is_string($value)) { |
305 | 305 | return mb_strimwidth($value, 0, self::MAX_STRING_LENGTH, '...'); |
306 | 306 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | protected function validEntity(object $entity): bool |
320 | 320 | { |
321 | 321 | //Dont log logentries itself! |
322 | - if ($entity instanceof AbstractDBElement && ! $entity instanceof AbstractLogEntry) { |
|
322 | + if ($entity instanceof AbstractDBElement && !$entity instanceof AbstractLogEntry) { |
|
323 | 323 | return true; |
324 | 324 | } |
325 | 325 |
@@ -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; |
@@ -27,11 +27,11 @@ |
||
27 | 27 | $this->addSql('ALTER TABLE `users` ADD perms_parts_parameters SMALLINT NOT NULL'); |
28 | 28 | $this->addSql('ALTER TABLE log CHANGE level level TINYINT'); |
29 | 29 | |
30 | - $sql = 'UPDATE `groups`' . |
|
30 | + $sql = 'UPDATE `groups`'. |
|
31 | 31 | 'SET perms_parts_parameters = 341 WHERE (id = 1 AND name = "admins") OR (id = 3 AND name = "users");'; |
32 | 32 | $this->addSql($sql); |
33 | 33 | |
34 | - $sql = 'UPDATE `groups`' . |
|
34 | + $sql = 'UPDATE `groups`'. |
|
35 | 35 | 'SET perms_parts_parameters = 681 WHERE (id = 2 AND name = "readonly");'; |
36 | 36 | $this->addSql($sql); |
37 | 37 |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | $dataTable->add('symbol', TextColumn::class, [ |
111 | 111 | 'label' => '', |
112 | - 'render' => function ($value, AbstractLogEntry $context) { |
|
112 | + 'render' => function($value, AbstractLogEntry $context) { |
|
113 | 113 | switch ($context->getLevelString()) { |
114 | 114 | case LogLevel::DEBUG: |
115 | 115 | $symbol = 'fa-bug'; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $dataTable->add('type', TextColumn::class, [ |
171 | 171 | 'label' => $this->translator->trans('log.type'), |
172 | 172 | 'propertyPath' => 'type', |
173 | - 'render' => function (string $value, AbstractLogEntry $context) { |
|
173 | + 'render' => function(string $value, AbstractLogEntry $context) { |
|
174 | 174 | return $this->translator->trans('log.type.'.$value); |
175 | 175 | }, |
176 | 176 | ]); |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | 'label' => $this->translator->trans('log.level'), |
180 | 180 | 'visible' => 'system_log' === $options['mode'], |
181 | 181 | 'propertyPath' => 'levelString', |
182 | - 'render' => function (string $value, AbstractLogEntry $context) { |
|
182 | + 'render' => function(string $value, AbstractLogEntry $context) { |
|
183 | 183 | return $value; |
184 | 184 | }, |
185 | 185 | ]); |
186 | 186 | |
187 | 187 | $dataTable->add('user', TextColumn::class, [ |
188 | 188 | 'label' => $this->translator->trans('log.user'), |
189 | - 'render' => function ($value, AbstractLogEntry $context) { |
|
189 | + 'render' => function($value, AbstractLogEntry $context) { |
|
190 | 190 | $user = $context->getUser(); |
191 | 191 | |
192 | 192 | return sprintf( |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $dataTable->add('target_type', TextColumn::class, [ |
201 | 201 | 'label' => $this->translator->trans('log.target_type'), |
202 | 202 | 'visible' => false, |
203 | - 'render' => function ($value, AbstractLogEntry $context) { |
|
203 | + 'render' => function($value, AbstractLogEntry $context) { |
|
204 | 204 | $class = $context->getTargetClass(); |
205 | 205 | if (null !== $class) { |
206 | 206 | return $this->elementTypeNameGenerator->getLocalizedTypeLabel($class); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $dataTable->add('timeTravel', IconLinkColumn::class, [ |
222 | 222 | 'label' => '', |
223 | 223 | 'icon' => 'fas fa-fw fa-eye', |
224 | - 'href' => function ($value, AbstractLogEntry $context) { |
|
224 | + 'href' => function($value, AbstractLogEntry $context) { |
|
225 | 225 | if ( |
226 | 226 | ($context instanceof TimeTravelInterface |
227 | 227 | && $context->hasOldDataInformations()) |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | |
240 | 240 | return null; |
241 | 241 | }, |
242 | - 'disabled' => function ($value, AbstractLogEntry $context) { |
|
242 | + 'disabled' => function($value, AbstractLogEntry $context) { |
|
243 | 243 | return |
244 | - ! $this->security->isGranted('@tools.timetravel') |
|
245 | - || ! $this->security->isGranted('show_history', $context->getTargetClass()); |
|
244 | + !$this->security->isGranted('@tools.timetravel') |
|
245 | + || !$this->security->isGranted('show_history', $context->getTargetClass()); |
|
246 | 246 | }, |
247 | 247 | ]); |
248 | 248 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | |
255 | 255 | $dataTable->createAdapter(ORMAdapter::class, [ |
256 | 256 | 'entity' => AbstractLogEntry::class, |
257 | - 'query' => function (QueryBuilder $builder) use ($options): void { |
|
257 | + 'query' => function(QueryBuilder $builder) use ($options): void { |
|
258 | 258 | $this->getQuery($builder, $options); |
259 | 259 | }, |
260 | 260 | ]); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | ]); |
281 | 281 | } |
282 | 282 | |
283 | - if (! empty($options['filter_elements'])) { |
|
283 | + if (!empty($options['filter_elements'])) { |
|
284 | 284 | foreach ($options['filter_elements'] as $element) { |
285 | 285 | /** @var AbstractDBElement $element */ |
286 | 286 |