From 8ec4add7820c2ff516a5c2ff428983ef5d57364e Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Tue, 18 Jul 2023 22:10:00 +0200 Subject: [PATCH] add new psr-4 optimized html class files WIP --- conlite/classes/Html/Html.php | 7 +++++ conlite/classes/Html/HtmlCommon.php | 42 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 conlite/classes/Html/Html.php create mode 100644 conlite/classes/Html/HtmlCommon.php diff --git a/conlite/classes/Html/Html.php b/conlite/classes/Html/Html.php new file mode 100644 index 0000000..8bdbe1d --- /dev/null +++ b/conlite/classes/Html/Html.php @@ -0,0 +1,7 @@ +attributes = $attributes; + } + + #[\ReturnTypeWillChange] + public function offsetExists(mixed $offset): bool + { + return isset($this->attributes[strtolower($offset)]); + } + + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->getAttribute($offset); + } + + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value): void + { + if (null !== $offset) { + $this->setAttribute($offset, $value); + } else { + $this->setAttribute($value); + } + } + + #[\ReturnTypeWillChange] + public function offsetUnset($offset): void + { + $this->removeAttribute($offset); + } +} \ No newline at end of file