@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | //Expand every line to a single entry: |
| 65 | 65 | $names = explode("\n", $lines); |
| 66 | 66 | |
| 67 | - if (! is_a($class_name, AbstractStructuralDBElement::class, true)) { |
|
| 67 | + if (!is_a($class_name, AbstractStructuralDBElement::class, true)) { |
|
| 68 | 68 | throw new InvalidArgumentException('$class_name must be a StructuralDBElement type!'); |
| 69 | 69 | } |
| 70 | - if (null !== $parent && ! is_a($parent, $class_name)) { |
|
| 70 | + if (null !== $parent && !is_a($parent, $class_name)) { |
|
| 71 | 71 | throw new InvalidArgumentException('$parent must have the same type as specified in $class_name!'); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | ]); |
| 185 | 185 | |
| 186 | 186 | //Ensure we have an array of entitity elements. |
| 187 | - if (! is_array($entities)) { |
|
| 187 | + if (!is_array($entities)) { |
|
| 188 | 188 | $entities = [$entities]; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $children = $element->getChildren(); |
| 59 | 59 | |
| 60 | 60 | //If we should call from top we execute the func here. |
| 61 | - if (! $call_from_bottom) { |
|
| 61 | + if (!$call_from_bottom) { |
|
| 62 | 62 | $func($element); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $em = $this->em; |
| 85 | 85 | |
| 86 | - $this->execute($element, static function (AbstractStructuralDBElement $element) use ($em): void { |
|
| 86 | + $this->execute($element, static function(AbstractStructuralDBElement $element) use ($em): void { |
|
| 87 | 87 | $em->remove($element); |
| 88 | 88 | }); |
| 89 | 89 | |
@@ -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; |
@@ -156,7 +156,7 @@ |
||
| 156 | 156 | //If no user id was passed, then we show info about the current user |
| 157 | 157 | if (null === $user) { |
| 158 | 158 | $tmp = $this->getUser(); |
| 159 | - if(!$tmp instanceof User) { |
|
| 159 | + if (!$tmp instanceof User) { |
|
| 160 | 160 | throw new InvalidArgumentException('Userinfo only works for database users!'); |
| 161 | 161 | } |
| 162 | 162 | $user = $tmp; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | //When user change its settings, he should be logged in fully. |
| 67 | 67 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
| 68 | 68 | |
| 69 | - if (! $user instanceof User) { |
|
| 69 | + if (!$user instanceof User) { |
|
| 70 | 70 | return new RuntimeException('This controller only works only for Part-DB User objects!'); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | //When user change its settings, he should be logged in fully. |
| 101 | 101 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
| 102 | 102 | |
| 103 | - if (! $user instanceof User) { |
|
| 103 | + if (!$user instanceof User) { |
|
| 104 | 104 | throw new RuntimeException('This controller only works only for Part-DB User objects!'); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | //When user change its settings, he should be logged in fully. |
| 153 | 153 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
| 154 | 154 | |
| 155 | - if (! $user instanceof User) { |
|
| 155 | + if (!$user instanceof User) { |
|
| 156 | 156 | return new RuntimeException('This controller only works only for Part-DB User objects!'); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | //When user change its settings, he should be logged in fully. |
| 187 | 187 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
| 188 | 188 | |
| 189 | - if (! $user instanceof User) { |
|
| 189 | + if (!$user instanceof User) { |
|
| 190 | 190 | throw new RuntimeException('This controller only works only for Part-DB User objects!'); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | $form->handleRequest($request); |
| 200 | 200 | |
| 201 | - if (! $this->demo_mode && $form->isSubmitted() && $form->isValid()) { |
|
| 201 | + if (!$this->demo_mode && $form->isSubmitted() && $form->isValid()) { |
|
| 202 | 202 | //Check if user theme setting has changed |
| 203 | 203 | if ($user->getTheme() !== $em->getUnitOfWork()->getOriginalEntityData($user)['theme']) { |
| 204 | 204 | $page_need_reload = true; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $pw_form->handleRequest($request); |
| 259 | 259 | |
| 260 | 260 | //Check if password if everything was correct, then save it to User and DB |
| 261 | - if (! $this->demo_mode && $pw_form->isSubmitted() && $pw_form->isValid()) { |
|
| 261 | + if (!$this->demo_mode && $pw_form->isSubmitted() && $pw_form->isValid()) { |
|
| 262 | 262 | $password = $passwordEncoder->encodePassword($user, $pw_form['new_password']->getData()); |
| 263 | 263 | $user->setPassword($password); |
| 264 | 264 | |
@@ -273,14 +273,14 @@ discard block |
||
| 273 | 273 | //Handle 2FA things |
| 274 | 274 | $google_form = $this->createForm(TFAGoogleSettingsType::class, $user); |
| 275 | 275 | $google_enabled = $user->isGoogleAuthenticatorEnabled(); |
| 276 | - if (! $google_enabled && ! $form->isSubmitted()) { |
|
| 276 | + if (!$google_enabled && !$form->isSubmitted()) { |
|
| 277 | 277 | $user->setGoogleAuthenticatorSecret($googleAuthenticator->generateSecret()); |
| 278 | 278 | $google_form->get('googleAuthenticatorSecret')->setData($user->getGoogleAuthenticatorSecret()); |
| 279 | 279 | } |
| 280 | 280 | $google_form->handleRequest($request); |
| 281 | 281 | |
| 282 | - if ( ! $this->demo_mode && $google_form->isSubmitted() && $google_form->isValid()) { |
|
| 283 | - if (! $google_enabled) { |
|
| 282 | + if (!$this->demo_mode && $google_form->isSubmitted() && $google_form->isValid()) { |
|
| 283 | + if (!$google_enabled) { |
|
| 284 | 284 | //Save 2FA settings (save secrets) |
| 285 | 285 | $user->setGoogleAuthenticatorSecret($google_form->get('googleAuthenticatorSecret')->getData()); |
| 286 | 286 | $backupCodeManager->enableBackupCodes($user); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | ])->getForm(); |
| 309 | 309 | |
| 310 | 310 | $backup_form->handleRequest($request); |
| 311 | - if (! $this->demo_mode && $backup_form->isSubmitted() && $backup_form->isValid()) { |
|
| 311 | + if (!$this->demo_mode && $backup_form->isSubmitted() && $backup_form->isValid()) { |
|
| 312 | 312 | $backupCodeManager->regenerateBackupCodes($user); |
| 313 | 313 | $em->flush(); |
| 314 | 314 | $this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated'); |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | $qb = $this->createQueryBuilder('log'); |
| 105 | 105 | $qb->select('log') |
| 106 | 106 | //->where('log INSTANCE OF App\Entity\LogSystem\ElementEditedLogEntry') |
| 107 | - ->where('log INSTANCE OF ' . $class) |
|
| 107 | + ->where('log INSTANCE OF '.$class) |
|
| 108 | 108 | ->andWhere('log.target_type = :target_type') |
| 109 | 109 | ->andWhere('log.target_id = :target_id') |
| 110 | 110 | ->orderBy('log.timestamp', 'DESC'); |