private function createElement($type, $children = array(), array $attributes = array(), $text = null)
    {
        $element = new NodeElement();
        $element->openTag($type);

        if (!empty($attributes)) {
            $element->addAttributes($attributes);
        }

        if (!empty($children)) {
            if ($children instanceof NodeElement) {
                $children = array($children);
            }

            $element->appendChildren($children);
        }

        if ($text !== null) {
            $element->setText($text);
        }

        $element->closeTag();

        return $element;
    }
private function createElement($type, $children = array(), array $attributes = array(), $text = null)
    {
        $element = new NodeElement();
        $element->openTag($type);

        if (!empty($attributes)) {
            $element->addAttributes($attributes);
        }

        if (!empty($children)) {
            if ($children instanceof NodeElement) {
                $children = array($children);
            }

            $element->appendChildren($children);
        }

        if ($text !== null) {
            $element->setText($text);
        }

        $element->closeTag();

        return $element;
    }
private function createElement ( $ type , $ children = array ( ) , array $ attributes = array ( ) , $ text = null ) { $ element = new NodeElement ( ) ; $ element -> openTag ( $ type ) ; if ( ! empty ( $ attributes ) ) { $ element -> addAttributes ( $ attributes ) ; } if ( ! empty ( $ children ) ) { if ( $ children instanceof NodeElement ) { $ children = array ( $ children ) ; } $ element -> appendChildren ( $ children ) ; } if ( $ text !== null ) { $ element -> setText ( $ text ) ; } $ element -> closeTag ( ) ; return $ element ; }
Shared element builder abstraction

@param string $type
@param array $children
@param array $attributes Optional element attributes
@param string $text
@return \Krystal\Form\NodeElement
Shared element builder abstraction