diff --git a/library/vendor/ipl/Html/Html.php b/library/vendor/ipl/Html/Html.php index 08d31a47..09ea6ae6 100644 --- a/library/vendor/ipl/Html/Html.php +++ b/library/vendor/ipl/Html/Html.php @@ -32,6 +32,25 @@ class Html implements ValidHtml return $this; } + /** + * @param $tag + * @return BaseElement + * @throws ProgrammingError + */ + public function getFirst($tag) + { + foreach ($this->content as $c) { + if ($c instanceof BaseElement && $c->getTag() === $tag) { + return $c; + } + } + + throw new ProgrammingError( + 'Trying to get first %s, but there is no such', + $tag + ); + } + /** * @param $content * @return $this @@ -81,7 +100,7 @@ class Html implements ValidHtml /** * @param Html|array|string $content - * @return self + * @return $this */ public function setContent($content) { @@ -146,7 +165,7 @@ class Html implements ValidHtml * @param $tag * @param null $attributes * @param null $content - * @return Element + * @return BaseElement */ public static function tag($tag, $attributes = null, $content = null) {