@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | $format = $request->get('format') ?? 'json'; |
62 | 62 | |
63 | 63 | //Check if we have one of the supported formats |
64 | - if (! in_array($format, ['json', 'csv', 'yaml', 'xml'], true)) { |
|
64 | + if (!in_array($format, ['json', 'csv', 'yaml', 'xml'], true)) { |
|
65 | 65 | throw new InvalidArgumentException('Given format is not supported!'); |
66 | 66 | } |
67 | 67 | |
68 | 68 | //Check export verbosity level |
69 | 69 | $level = $request->get('level') ?? 'extended'; |
70 | - if (! in_array($level, ['simple', 'extended', 'full'], true)) { |
|
70 | + if (!in_array($level, ['simple', 'extended', 'full'], true)) { |
|
71 | 71 | throw new InvalidArgumentException('Given level is not supported!'); |
72 | 72 | } |
73 | 73 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $response->headers->set('Content-Type', $content_type); |
114 | 114 | |
115 | 115 | //If view option is not specified, then download the file. |
116 | - if (! $request->get('view')) { |
|
116 | + if (!$request->get('view')) { |
|
117 | 117 | if ($entity instanceof AbstractNamedDBElement) { |
118 | 118 | $entity_name = $entity->getName(); |
119 | 119 | } elseif (is_array($entity)) { |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $item->setSelected(true); |
97 | 97 | } |
98 | 98 | |
99 | - if (! empty($item->getNodes())) { |
|
99 | + if (!empty($item->getNodes())) { |
|
100 | 100 | $item->addTag((string) \count($item->getNodes())); |
101 | 101 | } |
102 | 102 | |
103 | - if (! empty($href_type)) { |
|
103 | + if (!empty($href_type)) { |
|
104 | 104 | $entity = $this->em->getPartialReference($class, $item->getId()); |
105 | 105 | $item->setHref($this->urlGenerator->getURL($entity, $href_type)); |
106 | 106 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getGenericTree(string $class, ?AbstractStructuralDBElement $parent = null): array |
123 | 123 | { |
124 | - if (! is_a($class, AbstractNamedDBElement::class, true)) { |
|
124 | + if (!is_a($class, AbstractNamedDBElement::class, true)) { |
|
125 | 125 | throw new \InvalidArgumentException('$class must be a class string that implements StructuralDBElement or NamedDBElement!'); |
126 | 126 | } |
127 | - if (null !== $parent && ! is_a($parent, $class)) { |
|
127 | + if (null !== $parent && !is_a($parent, $class)) { |
|
128 | 128 | throw new \InvalidArgumentException('$parent must be of the type $class!'); |
129 | 129 | } |
130 | 130 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $secure_class_name = str_replace('\\', '_', $class); |
140 | 140 | $key = 'treeview_'.$this->keyGenerator->generateKey().'_'.$secure_class_name; |
141 | 141 | |
142 | - return $this->cache->get($key, function (ItemInterface $item) use ($repo, $parent, $secure_class_name) { |
|
142 | + return $this->cache->get($key, function(ItemInterface $item) use ($repo, $parent, $secure_class_name) { |
|
143 | 143 | // Invalidate when groups, a element with the class or the user changes |
144 | 144 | $item->tag(['groups', 'tree_treeview', $this->keyGenerator->generateKey(), $secure_class_name]); |
145 | 145 |
@@ -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; |
@@ -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 |