Skip to content

Commit

Permalink
Make Svg::sanitize() a public method
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers committed Nov 29, 2023
1 parent 2941ef4 commit c779404
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Support/Svg.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ class Svg
/**
* Extracts and sanitizes SVG code from a given file.
*
* @param string $path The path to the SVG file.
* @param boolean $minify Whether to minify the extracted SVG code.
* @return string
* @throws ApplicationException If no file, or a malformed SVG, is found at the given path.
*/
public static function extract($path, $minify = true)
public static function extract(string $path, bool $minify = true): string
{
if (!is_file($path)) {
throw new ApplicationException(sprintf('No SVG file found at path "%s"', $path));
Expand All @@ -40,12 +37,8 @@ public static function extract($path, $minify = true)
* Sanitizes SVG code.
*
* See https://github.com/darylldoyle/svg-sanitizer for usage of the underlying sanitization library.
*
* @param string $svg SVG code.
* @param boolean $minify Whether to minify the given SVG code.
* @return string
*/
protected static function sanitize($svg, $minify = true)
public static function sanitize(string $svg, bool $minify = true): string
{
$sanitizer = new Sanitizer();
$sanitizer->removeRemoteReferences(true);
Expand Down

0 comments on commit c779404

Please sign in to comment.