diff --git a/HtmlBuilder.php b/HtmlBuilder.php index 42ea738..12132d5 100644 --- a/HtmlBuilder.php +++ b/HtmlBuilder.php @@ -2,6 +2,28 @@ class HtmlBuilder { + /** + * Convert an HTML string to entities. + * + * @param string $value + * @return string + */ + public static function entities($value) + { + return htmlentities($value, ENT_QUOTES, 'UTF-8', false); + } + + /** + * Convert entities to HTML characters. + * + * @param string $value + * @return string + */ + public static function decode($value) + { + return html_entity_decode($value, ENT_QUOTES, 'UTF-8'); + } + /** * Generate an ordered list of items. *