From e8e78461f1f02ccee4d5cc21a699540524a5823f Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 23 Jun 2017 00:20:26 +0200 Subject: [PATCH] Html: upgrade to latest ipl master --- library/vendor/ipl/Html/Html.php | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/library/vendor/ipl/Html/Html.php b/library/vendor/ipl/Html/Html.php index 6b201aaf..08d31a47 100644 --- a/library/vendor/ipl/Html/Html.php +++ b/library/vendor/ipl/Html/Html.php @@ -153,6 +153,13 @@ class Html implements ValidHtml return Element::create($tag, $attributes, $content); } + /** + * @deprecated + * @param $name + * @param null $attributes + * @return Element + * @throws ProgrammingError + */ public static function element($name, $attributes = null) { // TODO: This might be anything here, add a better check @@ -170,6 +177,38 @@ class Html implements ValidHtml return $element; } + /** + * @param $name + * @param $arguments + * @return BaseElement + */ + public static function __callStatic($name, $arguments) + { + $attributes = array_shift($arguments); + $content = null; + if ($attributes instanceof ValidHtml || is_string($attributes)) { + $content = $attributes; + $attributes = null; + } elseif (is_array($attributes)) { + if (empty($attributes)) { + $attributes = null; + } elseif (is_int(key($attributes))) { + $content = $attributes; + $attributes = null; + } + } + + if (! empty($arguments)) { + if (null === $content) { + $content = $arguments; + } else { + $content = [$content, $arguments]; + } + } + + return Element::create($name, $attributes, $content); + } + /** * @param Exception|string $error * @return string