@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function make($tag, array $props = [], mixed $content = null): Tag |
| 83 | 83 | { |
| 84 | - if ( ! isset($this->tagFactories[$tag])) { |
|
| 84 | + if (!isset($this->tagFactories[$tag])) { |
|
| 85 | 85 | return Tag::create($tag, $props, $content, $this); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $tag = new $factory($props, $content, $this); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if ( ! $tag || ! $tag instanceof Tag) { |
|
| 98 | + if (!$tag || !$tag instanceof Tag) { |
|
| 99 | 99 | throw new \InvalidArgumentException(sprintf( |
| 100 | 100 | 'The constructor for the `%s` tag did not generate a Tag object', |
| 101 | 101 | $tag |
@@ -125,13 +125,13 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | $method = preg_replace('/([A-Z]+)/', '-\1', $method); |
| 127 | 127 | $method = strtolower((string) $method); |
| 128 | - if ( ! isset($args[0])) { |
|
| 128 | + if (!isset($args[0])) { |
|
| 129 | 129 | $args[0] = []; |
| 130 | 130 | } |
| 131 | - if ( ! isset($args[1])) { |
|
| 131 | + if (!isset($args[1])) { |
|
| 132 | 132 | $args[1] = []; |
| 133 | 133 | } |
| 134 | - if ( ! isset($args[2])) { |
|
| 134 | + if (!isset($args[2])) { |
|
| 135 | 135 | $args[2] = null; |
| 136 | 136 | } |
| 137 | 137 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | if ($value === null && isset($this->props[$name])) { |
| 107 | 107 | unset($this->props[$name]); |
| 108 | 108 | } elseif ($value !== null) { |
| 109 | - $this->props[(string)$name] = $value; |
|
| 109 | + $this->props[(string) $name] = $value; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | if (!$this->hasClass($class)) { |
| 157 | 157 | // @phpstan-ignore-next-line |
| 158 | - $this->set('class', trim((string) $this->get('class') . ' ' . $class)); |
|
| 158 | + $this->set('class', trim((string) $this->get('class').' '.$class)); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | return $this; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $classes = $this->get('class'); |
| 167 | 167 | if ($classes) { |
| 168 | 168 | // @phpstan-ignore-next-line |
| 169 | - $classes = trim((string) preg_replace('/(^| ){1}' . $class . '( |$){1}/i', ' ', (string) $classes)); |
|
| 169 | + $classes = trim((string) preg_replace('/(^| ){1}'.$class.'( |$){1}/i', ' ', (string) $classes)); |
|
| 170 | 170 | $this->set('class', $classes); |
| 171 | 171 | } |
| 172 | 172 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $classes = $this->get('class'); |
| 188 | 188 | |
| 189 | 189 | // @phpstan-ignore-next-line |
| 190 | - return $classes && ((bool) preg_match('/(^| ){1}' . $class . '( |$){1}/i', (string) $classes)); |
|
| 190 | + return $classes && ((bool) preg_match('/(^| ){1}'.$class.'( |$){1}/i', (string) $classes)); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | public function setContent(mixed $content): static |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | // @phpstan-ignore-next-line |
| 243 | 243 | $tagName = (string) $tagTextOrArray[0]; |
| 244 | - $props = (array) ($tagTextOrArray[1] ?? [ ]); |
|
| 245 | - $content = (array) ($tagTextOrArray[2] ?? [ ]); |
|
| 244 | + $props = (array) ($tagTextOrArray[1] ?? []); |
|
| 245 | + $content = (array) ($tagTextOrArray[2] ?? []); |
|
| 246 | 246 | // @phpstan-ignore-next-line |
| 247 | 247 | $tagTextOrArray = $this->builder->make($tagName, $props, $content); |
| 248 | 248 | } |
@@ -264,14 +264,14 @@ discard block |
||
| 264 | 264 | foreach ($this->props as $k => $v) { |
| 265 | 265 | if (!str_starts_with($k, '_')) { |
| 266 | 266 | if ($v === true) { |
| 267 | - $result .= $k . ' '; |
|
| 267 | + $result .= $k.' '; |
|
| 268 | 268 | } else { |
| 269 | - $result .= $k . '="' . $this->escapeAttr($v) . '" '; |
|
| 269 | + $result .= $k.'="'.$this->escapeAttr($v).'" '; |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | if ($result) { |
| 274 | - $result = ' ' . trim($result); |
|
| 274 | + $result = ' '.trim($result); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | return $result; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $before = !empty($this->before) ? implode(PHP_EOL, $this->before) : ''; |
| 310 | 310 | $after = !empty($this->after) ? implode(PHP_EOL, $this->after) : ''; |
| 311 | 311 | |
| 312 | - return $before . $element . $after; |
|
| 312 | + return $before.$element.$after; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | /** @var string $name */ |
| 36 | 36 | $name = $this->get('name'); |
| 37 | 37 | if (!str_ends_with($name, '[]')) { |
| 38 | - $this->set('name', $name . '[]'); |
|
| 38 | + $this->set('name', $name.'[]'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | return parent::render(); |