@@ -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 | |
@@ -524,7 +524,7 @@ |
||
| 524 | 524 | public function setName(string $new_name): AbstractNamedDBElement |
| 525 | 525 | { |
| 526 | 526 | // Anonymous user is not allowed to change its username |
| 527 | - if (! $this->isAnonymousUser()) { |
|
| 527 | + if (!$this->isAnonymousUser()) { |
|
| 528 | 528 | $this->name = $new_name; |
| 529 | 529 | } |
| 530 | 530 | |
@@ -176,7 +176,6 @@ |
||
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | 178 | * Get the comment of the element. |
| 179 | - |
|
| 180 | 179 | * |
| 181 | 180 | * @return string the comment |
| 182 | 181 | */ |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | //Check if both elements compared, are from the same type |
| 129 | 129 | // (we have to check inheritance, or we get exceptions when using doctrine entities (they have a proxy type): |
| 130 | - if (! is_a($another_element, $class_name) && ! is_a($this, get_class($another_element))) { |
|
| 130 | + if (!is_a($another_element, $class_name) && !is_a($this, get_class($another_element))) { |
|
| 131 | 131 | throw new InvalidArgumentException('isChildOf() only works for objects of the same type!'); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $tmp[] = $this; |
| 244 | 244 | |
| 245 | 245 | //We only allow 20 levels depth |
| 246 | - while (! end($tmp)->isRoot() && count($tmp) < 20) { |
|
| 246 | + while (!end($tmp)->isRoot() && count($tmp) < 20) { |
|
| 247 | 247 | $tmp[] = end($tmp)->parent; |
| 248 | 248 | } |
| 249 | 249 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | */ |
| 323 | 323 | public function setChildren($elements): self |
| 324 | 324 | { |
| 325 | - if (! is_array($elements) && ! $elements instanceof Collection) { |
|
| 325 | + if (!is_array($elements) && !$elements instanceof Collection) { |
|
| 326 | 326 | throw new InvalidArgumentException('$elements must be an array or Collection!'); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -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 | |