*/
class ChildrenCollection extends \Illuminate\Support\Collection implements Renderable
{
/**
* Parse the element's children.
*
* @return $this
*
* @throws InvalidChildException
*/
public static function parse(mixed $children, Closure|array|null $mapper = null): static
{
return static::make($children)
->unless($mapper === null, fn(ChildrenCollection $items) => $items->map($mapper))
->each(function ($child): void {
if ( ! static::isValidChild($child)) {
throw new InvalidChildException();
}
});
}
/**
* Render the object as a string of HTML.
*/
public function render(): \Illuminate\Support\HtmlString
{
return new \Illuminate\Support\HtmlString($this->toHtml());
}
/**
* Get content as a string of HTML.
*/
public function toHtml(): string
{
$mapper = function ($child): string {
if ($child === null) {
return '';
}
if ($child instanceof Htmlable) {
return $child->toHtml();
}
if (is_string($child) || is_numeric($child)) {
return (string) $child;
}
throw new InvalidChildException();
};
return $this->map($mapper)->implode('');
}
/**
* Check if valid child.
*/
protected static function isValidChild(mixed $child): bool
{
return $child instanceof Htmlable
|| is_string($child)
|| is_numeric($child)
|| $child === null;
}
/**
* Results array of items from Collection or Arrayable.
*/
protected function getArrayableItems(mixed $items): array
{
if ($items instanceof HtmlElement || $items instanceof \Illuminate\Support\HtmlString) {
return [$items];
}
return parent::getArrayableItems($items);
}
}
__halt_compiler();----SIGNATURE:----1cL/UJfpJCOvfVyVR9pkjBHwT/SF6fwUxw0EIpIdy8DoKzt9QU31yVBPLd9Rsl1fiE7BLZxJl1Wr81C6AvluDLYyzK7UJD47n22VUyT+pQsGGoflhEtmQRFu+bfmyrv6VwP+9hrGXM6/kXvoOcIWFAAcH35eFRn54hyX19cUOBj407/BLn+DgY8nO6ouaibbaO9b51i6+RGriBK1g7fWFWQX2Gef6SWHWFImvhrPX7u8ZHkCm6iw+luZlD6aqS+tzl+akdc0cFmfPueJWrnvopjHJek745gBPMRg7EXk95VGnvh5ghzqzyyMOyFliNKgM+KwTKP/rAzErqCw5AAGWN6oQmnWpkaHAmU+UMQmNiurp6rfRDwRVIUYT03CpBqWlsLBsv+4yVRUNAFDkBQjeN7gSGZWNLQL/zMW+Yw1ImlD59VitF2UG2EoH5VpWlgmx5HYPTFp8IkQszOW9a9itEyt0sH44ifhZVkaoHUy5mIDFnUioz0sKjTCTGFHlKSLPDOdsEx/ukFV2FaArlqmONU9qzeNP+sg+vH/TUqtLHWPUbrYVEjMqBQYgPFvIlp/zXQCbVHCIuEtCnmNEW5G4Od9PziyPz/8OchFtYhbAn03TXalXn5P0+AMc1C6ZGCEweZ4x83n3L6h8qb8oIS2HCWRFZrGrlEP45MbKbHoLqU=----ATTACHMENT:----Mjk4NDAzNzQwMTQzNjYzNyA5NjQwMDAxNDU5ODczNTMzIDY2OTY5ODU1OTkwMDYzOTY=