@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getDropdownProfiles(string $type): array |
39 | 39 | { |
40 | - if (! in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) { |
|
40 | + if (!in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) { |
|
41 | 41 | throw new \InvalidArgumentException('Invalid supported_element type given.'); |
42 | 42 | } |
43 | 43 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $type_children[] = $node; |
65 | 65 | } |
66 | 66 | |
67 | - if (! empty($type_children)) { |
|
67 | + if (!empty($type_children)) { |
|
68 | 68 | //Use default label e.g. 'part_label'. $$ marks that it will be translated in TreeViewGenerator |
69 | 69 | $tmp = new TreeViewNode('$$'.$type.'.label', null, $type_children); |
70 | 70 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function findForSupportedElement(string $type, array $order_by = ['name' => 'ASC']): array |
87 | 87 | { |
88 | - if (! in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) { |
|
88 | + if (!in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) { |
|
89 | 89 | throw new \InvalidArgumentException('Invalid supported_element type given.'); |
90 | 90 | } |
91 | 91 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | $this->allowedMethods = []; |
62 | 62 | foreach ($methods as $class => $m) { |
63 | - $this->allowedMethods[$class] = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]); |
|
63 | + $this->allowedMethods[$class] = array_map(function($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -77,19 +77,19 @@ discard block |
||
77 | 77 | public function checkSecurity($tags, $filters, $functions): void |
78 | 78 | { |
79 | 79 | foreach ($tags as $tag) { |
80 | - if (! \in_array($tag, $this->allowedTags, true)) { |
|
80 | + if (!\in_array($tag, $this->allowedTags, true)) { |
|
81 | 81 | throw new SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | 85 | foreach ($filters as $filter) { |
86 | - if (! \in_array($filter, $this->allowedFilters, true)) { |
|
86 | + if (!\in_array($filter, $this->allowedFilters, true)) { |
|
87 | 87 | throw new SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | foreach ($functions as $function) { |
92 | - if (! \in_array($function, $this->allowedFunctions, true)) { |
|
92 | + if (!\in_array($function, $this->allowedFunctions, true)) { |
|
93 | 93 | throw new SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function); |
94 | 94 | } |
95 | 95 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - if (! $allowed) { |
|
117 | + if (!$allowed) { |
|
118 | 118 | $class = \get_class($obj); |
119 | 119 | |
120 | 120 | throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | - if (! $allowed) { |
|
138 | + if (!$allowed) { |
|
139 | 139 | $class = \get_class($obj); |
140 | 140 | |
141 | 141 | throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); |
@@ -90,7 +90,7 @@ |
||
90 | 90 | */ |
91 | 91 | public function setContentDisposition($disposition, $filename, $filenameFallback = '') |
92 | 92 | { |
93 | - if ('' === $filenameFallback && (! preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) { |
|
93 | + if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) { |
|
94 | 94 | $encoding = mb_detect_encoding($filename, null, true) ?: '8bit'; |
95 | 95 | |
96 | 96 | for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) { |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | 'class' => 'selectpicker', |
66 | 66 | 'title' => 'selectpicker.nothing_selected', |
67 | 67 | ], |
68 | - 'choice_attr' => function (Options $options) { |
|
69 | - return function ($choice, $key, $value) use ($options) { |
|
68 | + 'choice_attr' => function(Options $options) { |
|
69 | + return function($choice, $key, $value) use ($options) { |
|
70 | 70 | /** @var Attachment $choice */ |
71 | 71 | $tmp = ['data-subtext' => $choice->getFilename() ?? 'URL']; |
72 | 72 | |
73 | - if ('picture' === $options['filter'] && ! $choice->isPicture()) { |
|
73 | + if ('picture' === $options['filter'] && !$choice->isPicture()) { |
|
74 | 74 | $tmp += ['disabled' => 'disabled']; |
75 | - } elseif ('3d_model' === $options['filter'] && ! $choice->is3DModel()) { |
|
75 | + } elseif ('3d_model' === $options['filter'] && !$choice->is3DModel()) { |
|
76 | 76 | $tmp += ['disabled' => 'disabled']; |
77 | 77 | } |
78 | 78 | |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | }; |
81 | 81 | }, |
82 | 82 | 'choice_label' => 'name', |
83 | - 'choice_loader' => function (Options $options) { |
|
84 | - return new CallbackChoiceLoader(function () use ($options) { |
|
83 | + 'choice_loader' => function(Options $options) { |
|
84 | + return new CallbackChoiceLoader(function() use ($options) { |
|
85 | 85 | $entity = $options['entity']; |
86 | - if (! $entity instanceof AttachmentContainingDBElement) { |
|
86 | + if (!$entity instanceof AttachmentContainingDBElement) { |
|
87 | 87 | throw new \RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)'); |
88 | 88 | } |
89 | 89 |
@@ -72,27 +72,27 @@ discard block |
||
72 | 72 | $builder |
73 | 73 | ->add('name', TextType::class, [ |
74 | 74 | 'label' => 'user.username.label', |
75 | - 'disabled' => ! $this->security->isGranted('edit_username', $options['data']) || $this->demo_mode, |
|
75 | + 'disabled' => !$this->security->isGranted('edit_username', $options['data']) || $this->demo_mode, |
|
76 | 76 | ]) |
77 | 77 | ->add('first_name', TextType::class, [ |
78 | 78 | 'required' => false, |
79 | 79 | 'label' => 'user.firstName.label', |
80 | - 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
80 | + 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
81 | 81 | ]) |
82 | 82 | ->add('last_name', TextType::class, [ |
83 | 83 | 'required' => false, |
84 | 84 | 'label' => 'user.lastName.label', |
85 | - 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
85 | + 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
86 | 86 | ]) |
87 | 87 | ->add('department', TextType::class, [ |
88 | 88 | 'required' => false, |
89 | 89 | 'label' => 'user.department.label', |
90 | - 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
90 | + 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
91 | 91 | ]) |
92 | 92 | ->add('email', EmailType::class, [ |
93 | 93 | 'required' => false, |
94 | 94 | 'label' => 'user.email.label', |
95 | - 'disabled' => ! $this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
95 | + 'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode, |
|
96 | 96 | ]) |
97 | 97 | ->add('language', LanguageType::class, [ |
98 | 98 | 'disabled' => $this->demo_mode, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ], |
125 | 125 | 'choice_translation_domain' => false, |
126 | 126 | 'choices' => User::AVAILABLE_THEMES, |
127 | - 'choice_label' => function ($entity, $key, $value) { |
|
127 | + 'choice_label' => function($entity, $key, $value) { |
|
128 | 128 | return $value; |
129 | 129 | }, |
130 | 130 | 'placeholder' => 'user_settings.theme.placeholder', |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | foreach ($results as $result) { |
155 | 155 | /** @var AbstractNamedDBElement $result */ |
156 | 156 | $io->writeln( |
157 | - 'Convert entity: '.$result->getName().' (' . get_class($result) . ': ' . $result->getID() . ')', |
|
157 | + 'Convert entity: '.$result->getName().' ('.get_class($result).': '.$result->getID().')', |
|
158 | 158 | OutputInterface::VERBOSITY_VERBOSE |
159 | 159 | ); |
160 | 160 | foreach ($properties as $property) { |
161 | 161 | //Retrieve bbcode from entity |
162 | 162 | $bbcode = $this->propertyAccessor->getValue($result, $property); |
163 | 163 | //Check if the current property really contains BBCode |
164 | - if (! preg_match(static::BBCODE_REGEX, $bbcode)) { |
|
164 | + if (!preg_match(static::BBCODE_REGEX, $bbcode)) { |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | $io->writeln( |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | //If we are not in dry run, save changes to DB |
185 | - if (! $input->getOption('dry-run')) { |
|
185 | + if (!$input->getOption('dry-run')) { |
|
186 | 186 | $this->em->flush(); |
187 | 187 | $io->success('Changes saved to DB successfully!'); |
188 | 188 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | public function getFilters() |
31 | 31 | { |
32 | 32 | return [ |
33 | - new TwigFilter('barcodeSVG', function (string $content, string $type = "QRCODE") { |
|
33 | + new TwigFilter('barcodeSVG', function(string $content, string $type = "QRCODE") { |
|
34 | 34 | $barcodeFactory = new Barcode(); |
35 | 35 | $barcode = $barcodeFactory->getBarcodeObj($type, $content); |
36 | 36 | return $barcode->getSvgCode(); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | ->setParameter(1, $element); |
38 | 38 | |
39 | 39 | foreach ($order_by as $field => $order) { |
40 | - $qb->addOrderBy('part.' . $field, $order); |
|
40 | + $qb->addOrderBy('part.'.$field, $order); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return $qb->getQuery()->getResult(); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | ->setParameter(1, $element); |
38 | 38 | |
39 | 39 | foreach ($order_by as $field => $order) { |
40 | - $qb->addOrderBy('part.' . $field, $order); |
|
40 | + $qb->addOrderBy('part.'.$field, $order); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return $qb->getQuery()->getResult(); |