Jyxo\HtmlTag::content PHP Method

content() public method

Creates and returns element's contents.
public content ( ) : string
return string
    public function content() : string
    {
        $buff = '';
        if (!$this->isEmptyElement) {
            $hasValue = isset($this->attributes['value']);
            $hasText = isset($this->attributes['text']);
            if ($hasValue || $hasText) {
                $text = $hasText ? $this->attributes['text'] : $this->attributes['value'];
                $noEncode = isset($this->noEncode['value']) || isset($this->noEncode['text']);
                // <script> contents are not escaped
                $noEncode = 'script' === $this->tag ? true : $noEncode;
                $buff .= $noEncode ? $text : String::escape($text);
            }
        }
        if (!$this->isEmptyElement && !empty($this->children)) {
            foreach ($this->children as $element) {
                $buff .= $element->render();
            }
        }
        return $buff;
    }