Skip to content

Commit 92285f3

Browse files
committed
Code optimizations.
1 parent c303ba1 commit 92285f3

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/HTMLServerComponentsCompiler.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,7 @@ public function process($content, array $options = [])
118118
}
119119
if ($srcAttributeValue !== null) {
120120
// todo check alias of alias
121-
if (isset($this->aliases[$srcAttributeValue])) {
122-
$sourceParts = explode(':', $this->aliases[$srcAttributeValue], 2);
123-
} else {
124-
$sourceParts = explode(':', $srcAttributeValue, 2);
125-
}
121+
$sourceParts = explode(':', isset($this->aliases[$srcAttributeValue]) ? $this->aliases[$srcAttributeValue] : $srcAttributeValue, 2);
126122
if (isset($sourceParts[0], $sourceParts[1])) {
127123
$scheme = $sourceParts[0];
128124
if ($scheme === 'data') {
@@ -220,9 +216,7 @@ public function makeComponent(array $attributes = [], string $innerHTML = '', st
220216
self::$newComponentCache = new \IvoPetkov\HTMLServerComponent();
221217
}
222218
$component = clone (self::$newComponentCache);
223-
foreach ($attributes as $name => $value) {
224-
$component->setAttribute($name, $value);
225-
}
219+
$component->setAttributes($attributes);
226220
$component->innerHTML = $innerHTML;
227221
$component->tagName = $tagName;
228222
return $component;

0 commit comments

Comments
 (0)