@@ -65,7 +65,7 @@ |
||
| 65 | 65 | public function replace(string $lines, object $target): string |
| 66 | 66 | { |
| 67 | 67 | $patterns = [ |
| 68 | - '/(\[\[[A-Z_]+\]\])/' => function ($match) use ($target) { |
|
| 68 | + '/(\[\[[A-Z_]+\]\])/' => function($match) use ($target) { |
|
| 69 | 69 | return $this->handlePlaceholder($match[0], $target); |
| 70 | 70 | }, |
| 71 | 71 | ]; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'attr' => [ |
| 96 | 96 | 'placeholder' => 'user.username.placeholder', |
| 97 | 97 | ], |
| 98 | - 'disabled' => ! $this->security->isGranted('edit_username', $entity), |
|
| 98 | + 'disabled' => !$this->security->isGranted('edit_username', $entity), |
|
| 99 | 99 | ]) |
| 100 | 100 | |
| 101 | 101 | ->add('group', StructuralEntityType::class, [ |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'required' => false, |
| 104 | 104 | 'label' => 'group.label', |
| 105 | 105 | 'disable_not_selectable' => true, |
| 106 | - 'disabled' => ! $this->security->isGranted('change_group', $entity), |
|
| 106 | + 'disabled' => !$this->security->isGranted('change_group', $entity), |
|
| 107 | 107 | ]) |
| 108 | 108 | |
| 109 | 109 | ->add('first_name', TextType::class, [ |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | 'placeholder' => 'user.firstName.placeholder', |
| 114 | 114 | ], |
| 115 | 115 | 'required' => false, |
| 116 | - 'disabled' => ! $this->security->isGranted('edit_infos', $entity), |
|
| 116 | + 'disabled' => !$this->security->isGranted('edit_infos', $entity), |
|
| 117 | 117 | ]) |
| 118 | 118 | |
| 119 | 119 | ->add('last_name', TextType::class, [ |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | 'placeholder' => 'user.lastName.placeholder', |
| 124 | 124 | ], |
| 125 | 125 | 'required' => false, |
| 126 | - 'disabled' => ! $this->security->isGranted('edit_infos', $entity), |
|
| 126 | + 'disabled' => !$this->security->isGranted('edit_infos', $entity), |
|
| 127 | 127 | ]) |
| 128 | 128 | |
| 129 | 129 | ->add('email', TextType::class, [ |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | 'placeholder' => 'user.email.placeholder', |
| 134 | 134 | ], |
| 135 | 135 | 'required' => false, |
| 136 | - 'disabled' => ! $this->security->isGranted('edit_infos', $entity), |
|
| 136 | + 'disabled' => !$this->security->isGranted('edit_infos', $entity), |
|
| 137 | 137 | ]) |
| 138 | 138 | |
| 139 | 139 | ->add('department', TextType::class, [ |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | 'placeholder' => 'user.department.placeholder', |
| 144 | 144 | ], |
| 145 | 145 | 'required' => false, |
| 146 | - 'disabled' => ! $this->security->isGranted('edit_infos', $entity), |
|
| 146 | + 'disabled' => !$this->security->isGranted('edit_infos', $entity), |
|
| 147 | 147 | ]) |
| 148 | 148 | |
| 149 | 149 | //Config section |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | 'placeholder' => 'user_settings.language.placeholder', |
| 157 | 157 | 'label' => 'user.language_select', |
| 158 | 158 | 'preferred_choices' => ['en', 'de'], |
| 159 | - 'disabled' => ! $this->security->isGranted('change_user_settings', $entity), |
|
| 159 | + 'disabled' => !$this->security->isGranted('change_user_settings', $entity), |
|
| 160 | 160 | ]) |
| 161 | 161 | ->add('timezone', TimezoneType::class, [ |
| 162 | 162 | 'required' => false, |
@@ -167,12 +167,12 @@ discard block |
||
| 167 | 167 | 'placeholder' => 'user_settings.timezone.placeholder', |
| 168 | 168 | 'label' => 'user.timezone.label', |
| 169 | 169 | 'preferred_choices' => ['Europe/Berlin'], |
| 170 | - 'disabled' => ! $this->security->isGranted('change_user_settings', $entity), |
|
| 170 | + 'disabled' => !$this->security->isGranted('change_user_settings', $entity), |
|
| 171 | 171 | ]) |
| 172 | 172 | ->add('theme', ChoiceType::class, [ |
| 173 | 173 | 'required' => false, |
| 174 | 174 | 'choices' => User::AVAILABLE_THEMES, |
| 175 | - 'choice_label' => function ($entity, $key, $value) { |
|
| 175 | + 'choice_label' => function($entity, $key, $value) { |
|
| 176 | 176 | return $value; |
| 177 | 177 | }, |
| 178 | 178 | 'attr' => [ |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | 'choice_translation_domain' => false, |
| 182 | 182 | 'placeholder' => 'user_settings.theme.placeholder', |
| 183 | 183 | 'label' => 'user.theme.label', |
| 184 | - 'disabled' => ! $this->security->isGranted('change_user_settings', $entity), |
|
| 184 | + 'disabled' => !$this->security->isGranted('change_user_settings', $entity), |
|
| 185 | 185 | ]) |
| 186 | 186 | ->add('currency', CurrencyEntityType::class, [ |
| 187 | 187 | 'required' => false, |
| 188 | 188 | 'label' => 'user.currency.label', |
| 189 | - 'disabled' => ! $this->security->isGranted('change_user_settings', $entity), |
|
| 189 | + 'disabled' => !$this->security->isGranted('change_user_settings', $entity), |
|
| 190 | 190 | ]) |
| 191 | 191 | |
| 192 | 192 | ->add('new_password', RepeatedType::class, [ |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | 'invalid_message' => 'password_must_match', |
| 201 | 201 | 'required' => false, |
| 202 | 202 | 'mapped' => false, |
| 203 | - 'disabled' => ! $this->security->isGranted('set_password', $entity), |
|
| 203 | + 'disabled' => !$this->security->isGranted('set_password', $entity), |
|
| 204 | 204 | 'constraints' => [new Length([ |
| 205 | 205 | 'min' => 6, |
| 206 | 206 | 'max' => 128, |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | 'class' => 'checkbox-custom', |
| 214 | 214 | ], |
| 215 | 215 | 'label' => 'user.edit.needs_pw_change', |
| 216 | - 'disabled' => ! $this->security->isGranted('set_password', $entity), |
|
| 216 | + 'disabled' => !$this->security->isGranted('set_password', $entity), |
|
| 217 | 217 | ]) |
| 218 | 218 | |
| 219 | 219 | ->add('disabled', CheckboxType::class, [ |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | 'class' => 'checkbox-custom', |
| 223 | 223 | ], |
| 224 | 224 | 'label' => 'user.edit.user_disabled', |
| 225 | - 'disabled' => ! $this->security->isGranted('set_password', $entity) |
|
| 225 | + 'disabled' => !$this->security->isGranted('set_password', $entity) |
|
| 226 | 226 | || $entity === $this->security->getUser(), |
| 227 | 227 | ]) |
| 228 | 228 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | ->add('permissions', PermissionsType::class, [ |
| 231 | 231 | 'mapped' => false, |
| 232 | 232 | 'data' => $builder->getData(), |
| 233 | - 'disabled' => ! $this->security->isGranted('edit_permissions', $entity), |
|
| 233 | + 'disabled' => !$this->security->isGranted('edit_permissions', $entity), |
|
| 234 | 234 | ]) |
| 235 | 235 | ; |
| 236 | 236 | /*->add('comment', CKEditorType::class, ['required' => false, |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | 'data_class' => $options['attachment_class'], |
| 251 | 251 | ], |
| 252 | 252 | 'by_reference' => false, |
| 253 | - 'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity), |
|
| 253 | + 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), |
|
| 254 | 254 | ]); |
| 255 | 255 | |
| 256 | 256 | $builder->add('log_comment', TextType::class, [ |
@@ -55,6 +55,6 @@ |
||
| 55 | 55 | |
| 56 | 56 | //Page is redirected to '/new', when delete was successful |
| 57 | 57 | $this->assertSame($delete, $client->getResponse()->isRedirect(static::$base_path.'/new')); |
| 58 | - $this->assertSame($delete, ! $client->getResponse()->isForbidden(), 'Permission Checking not working!'); |
|
| 58 | + $this->assertSame($delete, !$client->getResponse()->isForbidden(), 'Permission Checking not working!'); |
|
| 59 | 59 | } |
| 60 | 60 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | protected function supports($attribute, $subject) |
| 46 | 46 | { |
| 47 | 47 | if ($subject instanceof LabelProfile) { |
| 48 | - if (! isset(self::MAPPING[$attribute])) { |
|
| 48 | + if (!isset(self::MAPPING[$attribute])) { |
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | if ( |
| 177 | 177 | $entity instanceof LabelProfile |
| 178 | 178 | && 'twig' === $entity->getOptions()->getLinesMode() |
| 179 | - && ! $this->isGranted('@labels.use_twig') |
|
| 179 | + && !$this->isGranted('@labels.use_twig') |
|
| 180 | 180 | ) { |
| 181 | 181 | $form_options['disable_options'] = true; |
| 182 | 182 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $form->handleRequest($request); |
| 187 | 187 | if ($form->isSubmitted() && $form->isValid()) { |
| 188 | 188 | //Check if we editing a user and if we need to change the password of it |
| 189 | - if ($entity instanceof User && ! empty($form['new_password']->getData())) { |
|
| 189 | + if ($entity instanceof User && !empty($form['new_password']->getData())) { |
|
| 190 | 190 | $password = $this->passwordEncoder->encodePassword($entity, $form['new_password']->getData()); |
| 191 | 191 | $entity->setPassword($password); |
| 192 | 192 | //By default the user must change the password afterwards |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | 'attachment_class' => $this->attachment_class, |
| 228 | 228 | 'parameter_class' => $this->parameter_class, |
| 229 | 229 | ]); |
| 230 | - } elseif ($form->isSubmitted() && ! $form->isValid()) { |
|
| 230 | + } elseif ($form->isSubmitted() && !$form->isValid()) { |
|
| 231 | 231 | $this->addFlash('error', 'entity.edit_flash.invalid'); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $form->handleRequest($request); |
| 270 | 270 | |
| 271 | 271 | if ($form->isSubmitted() && $form->isValid()) { |
| 272 | - if ($new_entity instanceof User && ! empty($form['new_password']->getData())) { |
|
| 272 | + if ($new_entity instanceof User && !empty($form['new_password']->getData())) { |
|
| 273 | 273 | $password = $this->passwordEncoder->encodePassword($new_entity, $form['new_password']->getData()); |
| 274 | 274 | $new_entity->setPassword($password); |
| 275 | 275 | //By default the user must change the password afterwards |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]); |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if ($form->isSubmitted() && ! $form->isValid()) { |
|
| 307 | + if ($form->isSubmitted() && !$form->isValid()) { |
|
| 308 | 308 | $this->addFlash('error', 'entity.created_flash.invalid'); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | //We have to disable the options, if twig mode is selected and user is not allowed to use it. |
| 84 | - $disable_options = 'twig' === $label_options->getLinesMode() && ! $this->isGranted('@labels.use_twig'); |
|
| 84 | + $disable_options = 'twig' === $label_options->getLinesMode() && !$this->isGranted('@labels.use_twig'); |
|
| 85 | 85 | |
| 86 | 86 | $form = $this->createForm(LabelDialogType::class, null, [ |
| 87 | 87 | 'disable_options' => $disable_options, |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | $filename = 'invalid.pdf'; |
| 110 | 110 | |
| 111 | 111 | //Generate PDF either when the form is submitted and valid, or the form was not submit yet, and generate is set |
| 112 | - if (($form->isSubmitted() && $form->isValid()) || ($generate && ! $form->isSubmitted() && null !== $profile)) { |
|
| 112 | + if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && null !== $profile)) { |
|
| 113 | 113 | $target_id = (string) $form->get('target_id')->getData(); |
| 114 | 114 | $targets = $this->findObjects($form_options->getSupportedElement(), $target_id); |
| 115 | - if (! empty($targets)) { |
|
| 115 | + if (!empty($targets)) { |
|
| 116 | 116 | try { |
| 117 | 117 | $pdf_data = $this->labelGenerator->generateLabel($form_options, $targets); |
| 118 | 118 | $filename = $this->getLabelName($targets[0], $profile); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | protected function findObjects(string $type, string $ids): array |
| 147 | 147 | { |
| 148 | - if (! isset(LabelGenerator::CLASS_SUPPORT_MAPPING[$type])) { |
|
| 148 | + if (!isset(LabelGenerator::CLASS_SUPPORT_MAPPING[$type])) { |
|
| 149 | 149 | throw new \InvalidArgumentException('The given type is not known and can not be mapped to a class!'); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $prefix = $matches[1]; |
| 56 | 56 | $id = (int) $matches[2]; |
| 57 | 57 | |
| 58 | - if (! isset(self::PREFIX_TYPE_MAP[$prefix])) { |
|
| 58 | + if (!isset(self::PREFIX_TYPE_MAP[$prefix])) { |
|
| 59 | 59 | throw new \InvalidArgumentException('Unknown prefix '.$prefix); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $prefix = $matches[1]; |
| 68 | 68 | $id = (int) $matches[2]; |
| 69 | 69 | |
| 70 | - if (! isset(self::PREFIX_TYPE_MAP[$prefix])) { |
|
| 70 | + if (!isset(self::PREFIX_TYPE_MAP[$prefix])) { |
|
| 71 | 71 | throw new \InvalidArgumentException('Unknown prefix '.$prefix); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | |
| 103 | 103 | private function getStructuralData(string $class): AbstractStructuralDBElement |
| 104 | 104 | { |
| 105 | - if (! is_a($class, AbstractStructuralDBElement::class, true)) { |
|
| 105 | + if (!is_a($class, AbstractStructuralDBElement::class, true)) { |
|
| 106 | 106 | throw new \InvalidArgumentException('$class must be an child of AbstractStructuralDBElement'); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -53,16 +53,16 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function generateLabel(LabelOptions $options, $elements): string |
| 55 | 55 | { |
| 56 | - if (! is_array($elements) && ! is_object($elements)) { |
|
| 56 | + if (!is_array($elements) && !is_object($elements)) { |
|
| 57 | 57 | throw new \InvalidArgumentException('$element must be an object or an array of objects!'); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if (! is_array($elements)) { |
|
| 60 | + if (!is_array($elements)) { |
|
| 61 | 61 | $elements = [$elements]; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | foreach ($elements as $element) { |
| 65 | - if (! $this->supports($options, $element)) { |
|
| 65 | + if (!$this->supports($options, $element)) { |
|
| 66 | 66 | throw new \InvalidArgumentException('The given options are not compatible with the given element!'); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | public function supports(LabelOptions $options, object $element) |
| 84 | 84 | { |
| 85 | 85 | $supported_type = $options->getSupportedElement(); |
| 86 | - if (! isset(static::CLASS_SUPPORT_MAPPING[$supported_type])) { |
|
| 86 | + if (!isset(static::CLASS_SUPPORT_MAPPING[$supported_type])) { |
|
| 87 | 87 | throw new \InvalidArgumentException('Supported type name of the Label options not known!'); |
| 88 | 88 | } |
| 89 | 89 | |