@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | //Check if both elements compared, are from the same type |
126 | 126 | // (we have to check inheritance, or we get exceptions when using doctrine entities (they have a proxy type): |
127 | - if (! is_a($another_element, $class_name) && ! is_a($this, get_class($another_element))) { |
|
127 | + if (!is_a($another_element, $class_name) && !is_a($this, get_class($another_element))) { |
|
128 | 128 | throw new InvalidArgumentException('isChildOf() only works for objects of the same type!'); |
129 | 129 | } |
130 | 130 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $tmp[] = $this; |
241 | 241 | |
242 | 242 | //We only allow 20 levels depth |
243 | - while (! end($tmp)->isRoot() && count($tmp) < 20) { |
|
243 | + while (!end($tmp)->isRoot() && count($tmp) < 20) { |
|
244 | 244 | $tmp[] = end($tmp)->parent; |
245 | 245 | } |
246 | 246 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | { |
42 | 42 | if (null === $value) { |
43 | 43 | return $this->options['nullValue']; |
44 | - } elseif (! $value instanceof DateTimeInterface) { |
|
44 | + } elseif (!$value instanceof DateTimeInterface) { |
|
45 | 45 | $value = new DateTime((string) $value); |
46 | 46 | } |
47 | 47 |
@@ -60,11 +60,11 @@ |
||
60 | 60 | |
61 | 61 | public function render($value, $context) |
62 | 62 | { |
63 | - if (! $context instanceof Part) { |
|
63 | + if (!$context instanceof Part) { |
|
64 | 64 | throw new RuntimeException('$context must be a Part object!'); |
65 | 65 | } |
66 | 66 | $tmp = ''; |
67 | - $attachments = $context->getAttachments()->filter(function (Attachment $attachment) { |
|
67 | + $attachments = $context->getAttachments()->filter(function(Attachment $attachment) { |
|
68 | 68 | return $attachment->getShowInTable() && $this->attachmentManager->isFileExisting($attachment); |
69 | 69 | }); |
70 | 70 |
@@ -71,7 +71,7 @@ |
||
71 | 71 | */ |
72 | 72 | public function createNodesForClass(string $class, ObjectManager $manager): void |
73 | 73 | { |
74 | - if (! new $class() instanceof StructuralDBElement) { |
|
74 | + if (!new $class() instanceof StructuralDBElement) { |
|
75 | 75 | throw new InvalidArgumentException('$class must be a StructuralDBElement!'); |
76 | 76 | } |
77 | 77 |
@@ -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 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | //When user change its settings, he should be logged in fully. |
98 | 98 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
99 | 99 | |
100 | - if (! $user instanceof User) { |
|
100 | + if (!$user instanceof User) { |
|
101 | 101 | throw new RuntimeException('This controller only works only for Part-DB User objects!'); |
102 | 102 | } |
103 | 103 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | //When user change its settings, he should be logged in fully. |
147 | 147 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
148 | 148 | |
149 | - if (! $user instanceof User) { |
|
149 | + if (!$user instanceof User) { |
|
150 | 150 | return new RuntimeException('This controller only works only for Part-DB User objects!'); |
151 | 151 | } |
152 | 152 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | //When user change its settings, he should be logged in fully. |
175 | 175 | $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); |
176 | 176 | |
177 | - if (! $user instanceof User) { |
|
177 | + if (!$user instanceof User) { |
|
178 | 178 | throw new RuntimeException('This controller only works only for Part-DB User objects!'); |
179 | 179 | } |
180 | 180 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | $form->handleRequest($request); |
188 | 188 | |
189 | - if ($form->isSubmitted() && $form->isValid() && ! $this->demo_mode) { |
|
189 | + if ($form->isSubmitted() && $form->isValid() && !$this->demo_mode) { |
|
190 | 190 | //Check if user theme setting has changed |
191 | 191 | if ($user->getTheme() !== $em->getUnitOfWork()->getOriginalEntityData($user)['theme']) { |
192 | 192 | $page_need_reload = true; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $pw_form->handleRequest($request); |
247 | 247 | |
248 | 248 | //Check if password if everything was correct, then save it to User and DB |
249 | - if ($pw_form->isSubmitted() && $pw_form->isValid() && ! $this->demo_mode) { |
|
249 | + if ($pw_form->isSubmitted() && $pw_form->isValid() && !$this->demo_mode) { |
|
250 | 250 | $password = $passwordEncoder->encodePassword($user, $pw_form['new_password']->getData()); |
251 | 251 | $user->setPassword($password); |
252 | 252 | |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | //Handle 2FA things |
262 | 262 | $google_form = $this->createForm(TFAGoogleSettingsType::class, $user); |
263 | 263 | $google_enabled = $user->isGoogleAuthenticatorEnabled(); |
264 | - if (! $form->isSubmitted() && ! $google_enabled) { |
|
264 | + if (!$form->isSubmitted() && !$google_enabled) { |
|
265 | 265 | $user->setGoogleAuthenticatorSecret($googleAuthenticator->generateSecret()); |
266 | 266 | $google_form->get('googleAuthenticatorSecret')->setData($user->getGoogleAuthenticatorSecret()); |
267 | 267 | } |
268 | 268 | $google_form->handleRequest($request); |
269 | 269 | |
270 | - if ($google_form->isSubmitted() && $google_form->isValid() && ! $this->demo_mode) { |
|
271 | - if (! $google_enabled) { |
|
270 | + if ($google_form->isSubmitted() && $google_form->isValid() && !$this->demo_mode) { |
|
271 | + if (!$google_enabled) { |
|
272 | 272 | //Save 2FA settings (save secrets) |
273 | 273 | $user->setGoogleAuthenticatorSecret($google_form->get('googleAuthenticatorSecret')->getData()); |
274 | 274 | $backupCodeManager->enableBackupCodes($user); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | ])->getForm(); |
299 | 299 | |
300 | 300 | $backup_form->handleRequest($request); |
301 | - if ($backup_form->isSubmitted() && $backup_form->isValid() && ! $this->demo_mode) { |
|
301 | + if ($backup_form->isSubmitted() && $backup_form->isValid() && !$this->demo_mode) { |
|
302 | 302 | $backupCodeManager->regenerateBackupCodes($user); |
303 | 303 | $em->flush(); |
304 | 304 | $this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated'); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | throw new RuntimeException('You can not download external attachments!'); |
57 | 57 | } |
58 | 58 | |
59 | - if (! $helper->isFileExisting($attachment)) { |
|
59 | + if (!$helper->isFileExisting($attachment)) { |
|
60 | 60 | throw new RuntimeException('The file associated with the attachment is not existing!'); |
61 | 61 | } |
62 | 62 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | throw new RuntimeException('You can not download external attachments!'); |
87 | 87 | } |
88 | 88 | |
89 | - if (! $helper->isFileExisting($attachment)) { |
|
89 | + if (!$helper->isFileExisting($attachment)) { |
|
90 | 90 | throw new RuntimeException('The file associated with the attachment is not existing!'); |
91 | 91 | } |
92 | 92 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | //Check if a user has set a preferred language setting: |
63 | 63 | $user = $this->getUser(); |
64 | - if (($user instanceof User) && ! empty($user->getLanguage())) { |
|
64 | + if (($user instanceof User) && !empty($user->getLanguage())) { |
|
65 | 65 | $locale = $user->getLanguage(); |
66 | 66 | } |
67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $new_url = $request->getUriForPath('/'.$locale.$request->getPathInfo()); |
70 | 70 | |
71 | 71 | //If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string |
72 | - if (($this->enforce_index_php || ! $this->checkIfModRewriteAvailable()) |
|
72 | + if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable()) |
|
73 | 73 | && false === strpos($new_url, 'index.php')) { |
74 | 74 | //Like Request::getUriForPath only with index.php |
75 | 75 | $new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function checkIfModRewriteAvailable() |
89 | 89 | { |
90 | - if (! function_exists('apache_get_modules')) { |
|
90 | + if (!function_exists('apache_get_modules')) { |
|
91 | 91 | //If we can not check for apache modules, we just hope for the best and assume url rewriting is available |
92 | 92 | //If you want to enforce index.php versions of the url, you can override this via ENV vars. |
93 | 93 | return true; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ); |
99 | 99 | |
100 | 100 | //Check if user is allowed to read info, otherwise apply placeholder |
101 | - if ((null !== $annotation) && ! $this->isGranted('read', $annotation, $element)) { |
|
101 | + if ((null !== $annotation) && !$this->isGranted('read', $annotation, $element)) { |
|
102 | 102 | $property->setAccessible(true); |
103 | 103 | $value = $annotation->getPlaceholder(); |
104 | 104 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $property->setAccessible(true); |
147 | 147 | |
148 | 148 | //If the user is not allowed to edit or read this property, reset all values. |
149 | - if ((! $this->isGranted('read', $annotation, $element) |
|
150 | - || ! $this->isGranted('edit', $annotation, $element))) { |
|
149 | + if ((!$this->isGranted('read', $annotation, $element) |
|
150 | + || !$this->isGranted('edit', $annotation, $element))) { |
|
151 | 151 | //Set value to old value, so that there a no change to this property |
152 | 152 | if (isset($old_data[$property->getName()])) { |
153 | 153 | $property->setValue($element, $old_data[$property->getName()]); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | protected function isRunningFromCLI() |
172 | 172 | { |
173 | - if (empty($_SERVER['REMOTE_ADDR']) && ! isset($_SERVER['HTTP_USER_AGENT']) && count($_SERVER['argv']) > 0) { |
|
173 | + if (empty($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['HTTP_USER_AGENT']) && count($_SERVER['argv']) > 0) { |
|
174 | 174 | return true; |
175 | 175 | } |
176 | 176 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | //Check if we have already have saved the permission, otherwise save it to cache |
206 | - if (! isset($this->perm_cache[$mode][get_class($element)][$operation])) { |
|
206 | + if (!isset($this->perm_cache[$mode][get_class($element)][$operation])) { |
|
207 | 207 | $this->perm_cache[$mode][get_class($element)][$operation] = $this->security->isGranted($operation, $element); |
208 | 208 | } |
209 | 209 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'required' => false, |
113 | 113 | 'label' => 'attachment.edit.download_url', |
114 | 114 | 'mapped' => false, |
115 | - 'disabled' => ! $this->allow_attachments_download, |
|
115 | + 'disabled' => !$this->allow_attachments_download, |
|
116 | 116 | 'attr' => [ |
117 | 117 | 'class' => 'form-control-sm', |
118 | 118 | ], |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | //Check the secure file checkbox, if file is in securefile location |
142 | 142 | $builder->get('secureFile')->addEventListener( |
143 | 143 | FormEvents::PRE_SET_DATA, |
144 | - function (FormEvent $event): void { |
|
144 | + function(FormEvent $event): void { |
|
145 | 145 | $attachment = $event->getForm()->getParent()->getData(); |
146 | 146 | if ($attachment instanceof Attachment) { |
147 | 147 | $event->setData($attachment->isSecure()); |