*/
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:----WjtayPy8kCHjinWwQdriDdvLdyGNV15vsofx05hNiU90n4JRan7s6JdQXpMvr0hQ/PI4UqRoU/sLRmKj7DeZKOFRQdPSrb41cY/ak0E25EIHso6V21abqeUARj5nFLS+yv6fBgCJrMOQ/kv+jRIvr0vbOudGTDPxbMek43fyH48CXHtSihLSndYm8FeC+3DWn+uLepc1j+0VtSC6aQdBKPQYW9OFDslXTqwu3zjXblHA1FqgpRuuXP0X7Yu5uLOxAChnUJL0pfQe4TBmuJQNHHBmlaq6LqKzuVOB/gUeHtzlRF9RHNBsUCXe2IzYG66TatPk/XksGY7GWwCAip3gHLlUp8pIYHRVI0FRs173qHk+RzKv9itzJxUyB7Tu9j5Hb3VhSvvDAGMrxxOy3hDwufz7ZtpwueLlevpBywEoxkoUbN79aJBFckWkjlVdmsKYk2MXYwd7WxOsRqNEhozRtPfvLgy3RmkSTdHv5BNKqr49nHZsSLyLx73rp09dPgv7qtAWTRSkGHXVSfgjBYGm0wv51WUOa4Wn67ysyA8GW6TtXk+6O31t8rRXhqXq9gBh/F3vOp1mN1HVS9YN6C9f83YdLt5BWKxw33/I8tD0v/eq7ZKSL7DD4eIrw+vFEOGEWSXpAfolJAD1VURqndTSMs8gp+Syt/tE/8WA5EU3mhQ=----ATTACHMENT:----OTc0NDUxNjgxNzMyMDg0OSAzNTE4NjMyMTUzMzY3NDg1IDc4MjQxODc2MjY4MDc1Nzk=