diff --git a/src/Twig/Runtime/IconRuntime.php b/src/Twig/Runtime/IconRuntime.php index 9d5baa3..55a276b 100644 --- a/src/Twig/Runtime/IconRuntime.php +++ b/src/Twig/Runtime/IconRuntime.php @@ -156,7 +156,9 @@ final class IconRuntime implements RuntimeExtensionInterface return $svg; } - $this->throwIfTitleIsEmpty($title); + if ('' === $title) { + throw new \InvalidArgumentException('Title must not be an empty string!'); + } return preg_replace('/(\n?)/', "$1$title", $svg); } @@ -177,13 +179,6 @@ final class IconRuntime implements RuntimeExtensionInterface return trim(preg_replace('/<\?xml.*\?>/', '', $content)); } - private function throwIfTitleIsEmpty(string $title): void - { - if ('' === $title) { - throw new \InvalidArgumentException('Title string must not be empty!'); - } - } - private function setSvgHeightAndWidth(string $content, int $size): string { $this->throwIfSizeIsNegative($size);