ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TagCollection.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Data\Meta\Html;
22
23use Generator;
24
28class TagCollection extends Tag
29{
33 protected array $tags;
34
35 public function __construct(Tag ...$tags)
36 {
37 $this->tags = $tags;
38 }
39
43 public function toHtml(): string
44 {
45 $html = '';
46 foreach ($this->getTags() as $tag) {
47 $html .= $tag->toHtml();
48 $html .= PHP_EOL;
49 }
50
51 return $html;
52 }
53
57 public function getTags(): Generator
58 {
59 foreach ($this->tags as $tag) {
60 foreach ($tag->getTags() as $t) {
61 yield $t;
62 }
63 }
64 }
65}