Skip to content

Commit

Permalink
feat: HtmlHelper::stripZeroWidthCharacters
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 committed Oct 7, 2024
1 parent 7d1d4e1 commit 9b9c08e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions EMS/helpers/src/Html/HtmlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace EMS\Helpers\Html;

use EMS\Helpers\Standard\Type;

class HtmlHelper
{
/**
Expand Down Expand Up @@ -43,4 +45,13 @@ public static function isHtml(?string $source): bool

return $source !== \strip_tags($source);
}

public static function stripZeroWidthCharacters(?string $sourceHtml): ?string
{
if (null === $sourceHtml) {
return null;
}

return Type::string(\str_replace(['', '­'], ['', ''], $sourceHtml));
}
}

0 comments on commit 9b9c08e

Please sign in to comment.