@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function validate($value, Constraint $constraint): void |
45 | 45 | { |
46 | - if (! $constraint instanceof NoneOfItsChildren) { |
|
46 | + if (!$constraint instanceof NoneOfItsChildren) { |
|
47 | 47 | throw new UnexpectedTypeException($constraint, NoneOfItsChildren::class); |
48 | 48 | } |
49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | //Check type of value. Validating only works for StructuralDBElements |
57 | - if (! $value instanceof AbstractStructuralDBElement) { |
|
57 | + if (!$value instanceof AbstractStructuralDBElement) { |
|
58 | 58 | throw new UnexpectedValueException($value, 'StructuralDBElement'); |
59 | 59 | } |
60 | 60 |
@@ -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)) { |
@@ -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; |
@@ -85,7 +85,7 @@ |
||
85 | 85 | */ |
86 | 86 | protected function instanceToPermissionName($subject): ?string |
87 | 87 | { |
88 | - if (! is_string($subject)) { |
|
88 | + if (!is_string($subject)) { |
|
89 | 89 | $class_name = get_class($subject); |
90 | 90 | } else { |
91 | 91 | $class_name = $subject; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $optionsResolver->setAllowedTypes('search', ['null', 'string']); |
114 | 114 | |
115 | 115 | //Configure search options |
116 | - $optionsResolver->setDefault('search_options', function (OptionsResolver $resolver): void { |
|
116 | + $optionsResolver->setDefault('search_options', function(OptionsResolver $resolver): void { |
|
117 | 117 | $resolver->setDefaults([ |
118 | 118 | 'name' => true, |
119 | 119 | 'category' => true, |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $dataTable |
150 | 150 | ->add('picture', TextColumn::class, [ |
151 | 151 | 'label' => '', |
152 | - 'render' => function ($value, Part $context) { |
|
152 | + 'render' => function($value, Part $context) { |
|
153 | 153 | $preview_attachment = $this->previewGenerator->getTablePreviewAttachment($context); |
154 | 154 | if (null === $preview_attachment) { |
155 | 155 | return ''; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | ]) |
167 | 167 | ->add('name', TextColumn::class, [ |
168 | 168 | 'label' => $this->translator->trans('part.table.name'), |
169 | - 'render' => function ($value, Part $context) { |
|
169 | + 'render' => function($value, Part $context) { |
|
170 | 170 | return sprintf( |
171 | 171 | '<a href="%s">%s</a>', |
172 | 172 | $this->urlGenerator->infoURL($context), |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ]) |
196 | 196 | ->add('storelocation', TextColumn::class, [ |
197 | 197 | 'label' => $this->translator->trans('part.table.storeLocations'), |
198 | - 'render' => function ($value, Part $context) { |
|
198 | + 'render' => function($value, Part $context) { |
|
199 | 199 | $tmp = []; |
200 | 200 | foreach ($context->getPartLots() as $lot) { |
201 | 201 | //Ignore lots without storelocation |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ]) |
215 | 215 | ->add('amount', TextColumn::class, [ |
216 | 216 | 'label' => $this->translator->trans('part.table.amount'), |
217 | - 'render' => function ($value, Part $context) { |
|
217 | + 'render' => function($value, Part $context) { |
|
218 | 218 | $amount = $context->getAmountSum(); |
219 | 219 | |
220 | 220 | return $this->amountFormatter->format($amount, $context->getPartUnit()); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ->add('minamount', TextColumn::class, [ |
224 | 224 | 'label' => $this->translator->trans('part.table.minamount'), |
225 | 225 | 'visible' => false, |
226 | - 'render' => function ($value, Part $context) { |
|
226 | + 'render' => function($value, Part $context) { |
|
227 | 227 | return $this->amountFormatter->format($value, $context->getPartUnit()); |
228 | 228 | }, |
229 | 229 | ]) |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | ->addOrderBy('name') |
288 | 288 | ->createAdapter(FetchJoinORMAdapter::class, [ |
289 | 289 | 'simple_total_query' => true, |
290 | - 'query' => function (QueryBuilder $builder): void { |
|
290 | + 'query' => function(QueryBuilder $builder): void { |
|
291 | 291 | $this->getQuery($builder); |
292 | 292 | }, |
293 | 293 | 'entity' => Part::class, |
294 | 294 | 'criteria' => [ |
295 | - function (QueryBuilder $builder) use ($options): void { |
|
295 | + function(QueryBuilder $builder) use ($options): void { |
|
296 | 296 | $this->buildCriteria($builder, $options); |
297 | 297 | }, |
298 | 298 | new SearchCriteriaProvider(), |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | $builder->andWhere('part.tags LIKE :tag')->setParameter('tag', '%'.$options['tag'].'%'); |
376 | 376 | } |
377 | 377 | |
378 | - if (! empty($options['search'])) { |
|
379 | - if (! $options['search_options']['regex']) { |
|
378 | + if (!empty($options['search'])) { |
|
379 | + if (!$options['search_options']['regex']) { |
|
380 | 380 | //Dont show results, if no things are selected |
381 | 381 | $builder->andWhere('0=1'); |
382 | 382 | $defined = false; |