diff --git a/src/Twig/Runtime/IconRuntime.php b/src/Twig/Runtime/IconRuntime.php index 28430c5..47e6da6 100644 --- a/src/Twig/Runtime/IconRuntime.php +++ b/src/Twig/Runtime/IconRuntime.php @@ -84,12 +84,13 @@ final class IconRuntime implements RuntimeExtensionInterface private function getSanitisedIconSvg(string $iconName): string { $iconFilepath = $this->findSvgFilepath($iconName); - $rawSvgMarkup = $this->getSvgMarkup($iconFilepath); - $cleanSvgMarkup = $this->removeExistingTitleElement($rawSvgMarkup); - $cleanSvgMarkup = $this->removeBlackStrokeAttributes($cleanSvgMarkup); - $cleanSvgMarkup = $this->removeStrokeCurrentColor($cleanSvgMarkup); + $svg = $this->getSvgMarkup($iconFilepath); - return $this->removeBlackFillAttributes($cleanSvgMarkup); + $this->removeExistingTitleElement($svg); + $this->removeBlackStrokeAttributes($svg); + $this->removeStrokeCurrentColor($svg); + + return $this->removeBlackFillAttributes($svg); } private function findSvgFilepath(string $iconName): string @@ -110,19 +111,19 @@ final class IconRuntime implements RuntimeExtensionInterface return file_get_contents($filepath); } - private function removeExistingTitleElement(string $svg): string + private function removeExistingTitleElement(string &$svg): void { - return preg_replace('/