Render the whole element.

@param array $attributes attributes to override.
@param string HTML
494270
public function render( $attributes = array() ) 
    {
        if( ! $this->tagName ) {
            throw new Exception('tagName is not defined.');
        }

        $html = $this->open( $attributes );

        // render close tag
        if( $this->hasChildren() ) {
            $html .= $this->renderChildren();
        }

        $html .= $this->close();
        return $html;
    }
882208
private function applyAttributes($attributes)
    {
        if (array_key_exists('count', $attributes) && $attributes['count'] > 0) {
            $keys = array_keys($attributes);

            foreach ($keys as $key) {
                if (is_array($attributes[$key]) && array_key_exists(0, $attributes[$key])) {
                    // If the entry has multiple attributes, we'll make sure we loop through each one
                    if (array_key_exists('count', $attributes[$key]) && $attributes[$key]['count'] > 1) {
                        $data = [];

                        for ($i = 0; $i <= $attributes[$key]['count']; $i++) {
                            $data[] = $attributes[$key][$i];
                        }

                        $this->setAttribute($key, array_filter($data));
                    } else {
                        // Looks like only one attribute exists, let's set it
                        $this->setAttribute($key, $attributes[$key][0]);
                    }
                }
            }

            $this->applyExtraAttributes();
        }
    }
1287816
public static function renderAttributes(array $attributes)
    {
        $html = [];
        foreach ($attributes as $key => $value) {
            $escaped = htmlentities($value, ENT_QUOTES, 'UTF-8', false);
            $html[] = is_numeric($key) ?
                ($escaped . '="' . $escaped . '""')
                :
                ("$key=\"$escaped\"");
        }
        return count($html) > 0 ? ' ' . implode(' ', $html) : '';
    }
454562
public function getHtml(array $attributes = []): string
    {
        return self::buildTag('input', null,
            array_merge(
                [
                    'type'     => $this->getType(),
                    'name'     => $this->getName(),
                    'value'    => $this->getText() !== '' ? $this->getText() : false,
                    'required' => $this->isRequired(),
                ],
                $attributes
            )
        );
    }
578153
public function setAttributes(array $attributes): void
    {
        $this->checkAttributeAssignable(array_keys($attributes));

        $this->setRawAttributes($attributes);
    }
304478
protected function _render( $template_name, $attributes ) {
		$path = __DIR__ . '/app/view/' . $template_name . '.php';
		if ( ! file_exists( $path ) ) {
			return;
		}

		// @todo Using getter method
		// @codingStandardsIgnoreStart
		extract( $attributes );
		// @codingStandardsIgnoreEnd
		ob_start();
		include( $path );
		return ob_get_clean();
	}
1270338
protected function _renderAttributes($keys) 
    {
        $html = '';
        foreach( $keys as $key ) {
            if( $val = $this->$key ) {
                if( is_array($val) ) {

                    // check if the array is an indexed array, check keys of 
                    // array[0..cnt] 
                    //
                    // if it's an indexed array
                    // for attributes key like "class", the value can be 
                    //
                    //     array('class1','class2')
                    //
                    // this renders the attribute as "class1 class2"
                    //
                    // if it's an associative array
                    // for attribute key like "style", the value can be 
                    //
                    //      array( 'border' => '1px solid #ccc' )
                    //
                    // this renders the attribute as 
                    //
                    //      "border: 1px solid #ccc;"
                    //
                    if( array_keys($val) === range(0, count($val)-1) ) {
                        $val = join(' ', $val);
                    } else {
                        $val0 = $val;
                        $val = '';
                        foreach( $val0 as $name => $data ) {
                            $val .= "$name:$data;";
                        }
                    }
                }
                // for boolean type values like readonly attribute, 
                // we render it as readonly="readonly".
                elseif ( is_bool($val) ) {
                    $val = $key;
                }

                // Convert camalcase name to dash-separated name
                //
                // for dataUrl attributes, render these attributes like data-url
                // ( use dash separator)
                $html .= sprintf(' %s="%s"', 
                        strtolower(preg_replace('/[A-Z]/', '-$0', $key)),
                        htmlspecialchars( $val )
                );
            }
        }
        return $html;
    }
1088997
public function addAttributes($attributes)
    {
        foreach ($attributes as $name => $value) {
            if (!is_array($value)) {
                $value = [$value];
            }
            parent::attr($name, ...$value);
        }

        return $this;
    }
1183405
private function formatHtmlAttribute($attributes = [])
    {
        $attrArr = [];
        foreach ($attributes as $name => $val) {
            $attrArr[] = "$name=\"$val\"";
        }

        return implode(' ', $attrArr);
    }
922205
public function render(Autocomplete $autocomplete, array $attributes = [])
    {
        $autocomplete->addInputAttributes($attributes);

        return $this->placeAutocompleteHelper->render($autocomplete);
    }
749250
public function setLinkAttributes($attributes)
    {
        if (! is_array($attributes)) {
            $attributes = [$attributes];
        }

        $this->link_attributes = $attributes;

        return $this;
    }
824341
public function setAttributes($selector, array $attributes)
    {
        $nodes = $this->get($selector);

        foreach ($nodes as $node) {
            $node->setAttributes($attributes);
        }
    }
943653
private function fill($attributes)
    {
        // json
        if (is_string($attributes)) {
            $attributes = json_decode($attributes, true);
        }

        // check if attributes are valid
        if (!is_array($attributes)) {
            throw new \InvalidArgumentException('Attributes must be of type array or a valid json string');
        }

        foreach ($attributes as $key => $value) {
            $this->setAttribute($key, $value);
        }
    }
384341
public function th(string $text = '', array $attributes = []): void
    {
        $this->tdArray[] = Tags::th($text, $attributes);
    }
238774
protected function renderAttributes(array $attributes)
    {
        foreach ($attributes as $name => $value) {
            if (is_array($value)) {
                $value = implode(' ', (array) $value);
            }
            $attributes[$name] = $name . '="' . htmlspecialchars($value, ENT_QUOTES, 'UTF-8') . '"';
        }

        return implode(' ', $attributes);
    }
1289858
public function getHtml(array $attributes = []): string
    {
        if ($this->minimumValue !== null) {
            $attributes['min'] = $this->minimumValue;
        }

        if ($this->maximumValue !== null) {
            $attributes['max'] = $this->maximumValue;
        }

        return parent::getHtml($attributes);
    }
749145
public function getHtml(array $attributes = []): string
    {
        $result = '';
        foreach ($this->radioButtons as $radioButton) {
            $result .= $radioButton->getHtml($attributes) . htmlspecialchars($radioButton->getLabel());
        }

        return $result;
    }