@@ -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'); |
@@ -163,7 +163,7 @@ |
||
| 163 | 163 | //If no user id was passed, then we show info about the current user |
| 164 | 164 | if (null === $user) { |
| 165 | 165 | $tmp = $this->getUser(); |
| 166 | - if (! $tmp instanceof User) { |
|
| 166 | + if (!$tmp instanceof User) { |
|
| 167 | 167 | throw new InvalidArgumentException('Userinfo only works for database users!'); |
| 168 | 168 | } |
| 169 | 169 | $user = $tmp; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $this->addFlash('info', 'part.edited_flash'); |
| 181 | 181 | //Reload form, so the SIUnitType entries use the new part unit |
| 182 | 182 | $form = $this->createForm(PartBaseType::class, $part); |
| 183 | - } elseif ($form->isSubmitted() && ! $form->isValid()) { |
|
| 183 | + } elseif ($form->isSubmitted() && !$form->isValid()) { |
|
| 184 | 184 | $this->addFlash('error', 'part.edited_flash.invalid'); |
| 185 | 185 | } |
| 186 | 186 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @return Response |
| 226 | 226 | */ |
| 227 | 227 | public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator, |
| 228 | - AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler, ?Part $part = null): Response |
|
| 228 | + AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler, ?Part $part = null) : Response |
|
| 229 | 229 | { |
| 230 | 230 | if (null === $part) { |
| 231 | 231 | $new_part = new Part(); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if ($form->isSubmitted() && ! $form->isValid()) { |
|
| 278 | + if ($form->isSubmitted() && !$form->isValid()) { |
|
| 279 | 279 | $this->addFlash('error', 'part.created_flash.invalid'); |
| 280 | 280 | } |
| 281 | 281 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $form->handleRequest($request); |
| 162 | 162 | if ($form->isSubmitted() && $form->isValid()) { |
| 163 | 163 | //Check if we editing a user and if we need to change the password of it |
| 164 | - if ($entity instanceof User && ! empty($form['new_password']->getData())) { |
|
| 164 | + if ($entity instanceof User && !empty($form['new_password']->getData())) { |
|
| 165 | 165 | $password = $this->passwordEncoder->encodePassword($entity, $form['new_password']->getData()); |
| 166 | 166 | $entity->setPassword($password); |
| 167 | 167 | //By default the user must change the password afterwards |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | 'attachment_class' => $this->attachment_class, |
| 200 | 200 | 'parameter_class' => $this->parameter_class |
| 201 | 201 | ]); |
| 202 | - } elseif ($form->isSubmitted() && ! $form->isValid()) { |
|
| 202 | + } elseif ($form->isSubmitted() && !$form->isValid()) { |
|
| 203 | 203 | $this->addFlash('error', 'entity.edit_flash.invalid'); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $form->handleRequest($request); |
| 230 | 230 | |
| 231 | 231 | if ($form->isSubmitted() && $form->isValid()) { |
| 232 | - if ($new_entity instanceof User && ! empty($form['new_password']->getData())) { |
|
| 232 | + if ($new_entity instanceof User && !empty($form['new_password']->getData())) { |
|
| 233 | 233 | $password = $this->passwordEncoder->encodePassword($new_entity, $form['new_password']->getData()); |
| 234 | 234 | $new_entity->setPassword($password); |
| 235 | 235 | //By default the user must change the password afterwards |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - if ($form->isSubmitted() && ! $form->isValid()) { |
|
| 267 | + if ($form->isSubmitted() && !$form->isValid()) { |
|
| 268 | 268 | $this->addFlash('error', 'entity.created_flash.invalid'); |
| 269 | 269 | } |
| 270 | 270 | |
@@ -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; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | //Check if both elements compared, are from the same type |
| 129 | 129 | // (we have to check inheritance, or we get exceptions when using doctrine entities (they have a proxy type): |
| 130 | - if (! is_a($another_element, $class_name) && ! is_a($this, get_class($another_element))) { |
|
| 130 | + if (!is_a($another_element, $class_name) && !is_a($this, get_class($another_element))) { |
|
| 131 | 131 | throw new InvalidArgumentException('isChildOf() only works for objects of the same type!'); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $tmp[] = $this; |
| 244 | 244 | |
| 245 | 245 | //We only allow 20 levels depth |
| 246 | - while (! end($tmp)->isRoot() && count($tmp) < 20) { |
|
| 246 | + while (!end($tmp)->isRoot() && count($tmp) < 20) { |
|
| 247 | 247 | $tmp[] = end($tmp)->parent; |
| 248 | 248 | } |
| 249 | 249 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | */ |
| 323 | 323 | public function setChildren($elements): self |
| 324 | 324 | { |
| 325 | - if (! is_array($elements) && ! $elements instanceof Collection) { |
|
| 325 | + if (!is_array($elements) && !$elements instanceof Collection) { |
|
| 326 | 326 | throw new InvalidArgumentException('$elements must be an array or Collection!'); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -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 |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | |
| 110 | 110 | public function hasOldDataInformations(): bool |
| 111 | 111 | { |
| 112 | - return ! empty($this->extra['o']); |
|
| 112 | + return !empty($this->extra['o']); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | public function getOldData(): array |