From a1ec78bf0dc93d0e05e5f066f1949dc3baecea06 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:44:51 +0200 Subject: Adding upstream version 0.20.0. Signed-off-by: Daniel Baumann --- vendor/gipfl/web/src/HtmlHelper.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 vendor/gipfl/web/src/HtmlHelper.php (limited to 'vendor/gipfl/web/src/HtmlHelper.php') diff --git a/vendor/gipfl/web/src/HtmlHelper.php b/vendor/gipfl/web/src/HtmlHelper.php new file mode 100644 index 0000000..19862f8 --- /dev/null +++ b/vendor/gipfl/web/src/HtmlHelper.php @@ -0,0 +1,29 @@ +getAttributes(), $class); + } + + public static function addClassOnce(Attributes $attributes, $class) + { + if (! HtmlHelper::classIsSet($attributes, $class)) { + $attributes->add('class', $class); + } + } + + public static function classIsSet(Attributes $attributes, $class) + { + $classes = $attributes->get('class'); + + return \is_array($classes) && in_array($class, $classes) + || \is_string($classes) && $classes === $class; + } +} -- cgit v1.2.3