Inline method call

This commit is contained in:
brabli
2023-06-26 21:30:41 +01:00
parent 90a354f822
commit e3d3818b10

View File

@@ -156,7 +156,9 @@ final class IconRuntime implements RuntimeExtensionInterface
return $svg; return $svg;
} }
$this->throwIfTitleIsEmpty($title); if ('' === $title) {
throw new \InvalidArgumentException('Title must not be an empty string!');
}
return preg_replace('/(<svg(.|\n)*?>\n?)/', "$1<title>$title</title>", $svg); return preg_replace('/(<svg(.|\n)*?>\n?)/', "$1<title>$title</title>", $svg);
} }
@@ -177,13 +179,6 @@ final class IconRuntime implements RuntimeExtensionInterface
return trim(preg_replace('/<\?xml.*\?>/', '', $content)); 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 private function setSvgHeightAndWidth(string $content, int $size): string
{ {
$this->throwIfSizeIsNegative($size); $this->throwIfSizeIsNegative($size);