@@ -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 |
@@ -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 |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function setElement(AbstractDBElement $element): self |
| 193 | 193 | { |
| 194 | - if (! is_a($element, static::ALLOWED_ELEMENT_CLASS)) { |
|
| 194 | + if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) { |
|
| 195 | 195 | throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS)); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | protected function formatWithUnit(float $value, string $format = '%g'): string |
| 410 | 410 | { |
| 411 | 411 | $str = \sprintf($format, $value); |
| 412 | - if (! empty($this->unit)) { |
|
| 412 | + if (!empty($this->unit)) { |
|
| 413 | 413 | return $str.' '.$this->unit; |
| 414 | 414 | } |
| 415 | 415 | |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | 'currency' => Currency::class, |
| 104 | 104 | ]; |
| 105 | 105 | |
| 106 | - if (! isset($arr[$type])) { |
|
| 106 | + if (!isset($arr[$type])) { |
|
| 107 | 107 | throw new \InvalidArgumentException('No count for the given type available!'); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | |
| 44 | 44 | public function setMode(string $mode): void |
| 45 | 45 | { |
| 46 | - if (! in_array($mode, self::ALLOWED_MODES, true)) { |
|
| 46 | + if (!in_array($mode, self::ALLOWED_MODES, true)) { |
|
| 47 | 47 | throw new \InvalidArgumentException('Invalid mode passed!'); |
| 48 | 48 | } |
| 49 | 49 | $this->mode = $mode; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function revertEntityToTimestamp(AbstractDBElement $element, \DateTime $timestamp, array $reverted_elements = []): void |
| 81 | 81 | { |
| 82 | - if (! $element instanceof TimeStampableInterface) { |
|
| 82 | + if (!$element instanceof TimeStampableInterface) { |
|
| 83 | 83 | throw new \InvalidArgumentException('$element must have a Timestamp!'); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | foreach ($target_elements as $target_element) { |
| 154 | 154 | if (null !== $target_element && $element->getLastModified() >= $timestamp) { |
| 155 | 155 | //Remove the element from collection, if it did not existed at $timestamp |
| 156 | - if (! $this->repo->getElementExistedAtTimestamp($target_element, $timestamp)) { |
|
| 156 | + if (!$this->repo->getElementExistedAtTimestamp($target_element, $timestamp)) { |
|
| 157 | 157 | if ($target_elements instanceof Collection) { |
| 158 | 158 | $target_elements->removeElement($target_element); |
| 159 | 159 | } |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | public function applyEntry(AbstractDBElement $element, TimeTravelInterface $logEntry): void |
| 174 | 174 | { |
| 175 | 175 | //Skip if this does not provide any info... |
| 176 | - if (! $logEntry->hasOldDataInformations()) { |
|
| 176 | + if (!$logEntry->hasOldDataInformations()) { |
|
| 177 | 177 | return; |
| 178 | 178 | } |
| 179 | - if (! $element instanceof TimeStampableInterface) { |
|
| 179 | + if (!$element instanceof TimeStampableInterface) { |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | $metadata = $this->em->getClassMetadata(get_class($element)); |