HtmlObject\Traits\Tag::openOn PHP Method

openOn() public method

Open the tag tree on a particular child.
public openOn ( $onChildren ) : string
return string
    public function openOn($onChildren)
    {
        $onChildren = explode('.', $onChildren);
        $element = $this->open();
        $element .= $this->value;
        $subject = $this;
        foreach ($onChildren as $onChild) {
            foreach ($subject->getChildren() as $childName => $child) {
                if ($childName != $onChild) {
                    $element .= $child;
                } else {
                    $subject = $child;
                    $element .= $child->open();
                    break;
                }
            }
        }
        return $element;
    }