diff --git a/src/Twig/Runtime/IconRuntime.php b/src/Twig/Runtime/IconRuntime.php index 170bacf..9d5baa3 100644 --- a/src/Twig/Runtime/IconRuntime.php +++ b/src/Twig/Runtime/IconRuntime.php @@ -39,7 +39,7 @@ final class IconRuntime implements RuntimeExtensionInterface */ public function renderIcon(array $userOptions): string { - $options = $this->getMergedOptions($userOptions); + $options = $this->mergeWithDefaultOptions($userOptions); $svg = $this->getSanitisedIconSvg($options['icon']); @@ -58,7 +58,7 @@ final class IconRuntime implements RuntimeExtensionInterface return implode(' ', $extraClasses); } - private function getMergedOptions(array $userOptions): array + private function mergeWithDefaultOptions(array $userOptions): array { $this->throwIfUnrecognisedOptionExists($userOptions); return $this->mergeUserOptionsWithDefaults($userOptions); @@ -187,6 +187,7 @@ final class IconRuntime implements RuntimeExtensionInterface private function setSvgHeightAndWidth(string $content, int $size): string { $this->throwIfSizeIsNegative($size); + $svgAsXmlElement = new \SimpleXMLElement($content); $svgAsXmlElement = $this->addAttributeToXmlElement($svgAsXmlElement, 'width', $size); $svgAsXmlElement = $this->addAttributeToXmlElement($svgAsXmlElement, 'height', $size);