make attribute ids (aids) and index all attributes by aid at ids

@param  $attrs
@return array
777053
private function _index_attribs($attrs)
    {
        $this->attr_idx = $this->attrs = $aix = $six = $iix = $iax = self::$_ar_;
        $i              = 0;
        $ian            = self::$_index_attribs;
        foreach ($ian as $atn) {
            if (!isset($iax[$atn])) {
                $iax[$atn] = self::$_ar_;
            }
        }

        foreach ($attrs as $str => $v) {
            $a = self::html_parseAttrStr($str, true, false);
            unset($attrs[$str]); // free mem
            foreach ($ian as $atn) {
                if (isset($a[$atn])) {
                    // href attribute has a separate index
                    if (is_array($v)) {
                        foreach ($v as $e) {
                            $iax[$atn][$e] = $a[$atn];
                        }

                    } else {
                        $iax[$atn][$v] = $a[$atn];
                    }
                    unset($a[$atn]);
                }
            }
            if (empty($a)) {
                continue;
            }

            $str = self::html_attr2str($a);
            $aid = $i;
            if (isset($six[$str])) {
                $aid = $six[$str];
                if (!is_array($iix[$aid])) {
                    $iix[$aid] = array($iix[$aid]);
                }

                if (is_array($v)) {
                    foreach ($v as $v_) {
                        $iix[$aid][] = $v_;
                    }
                } else {
                    $iix[$aid][] = $v;
                }

            } else {
                $six[$str] = $aid;
                $aix[$aid] = $a;
                $iix[$aid] = $v;
                ++$i;
            }
        }
        unset($six, $attrs, $i); // free mem
        foreach ($aix as $aid => $a) {
            $v = $iix[$aid];
            if (is_array($v)) {
                if (count($v) == 1) {
                    $v = reset($v);
                } elseif ($v) {
                    $u = array();
                    foreach ($v as $e) {
                        $u[$e]           = $this->ids[$e];
                        $this->attrs[$e] = $aid;
                    }
                    $v = $u;unset($u);
                }
            }
            if (!is_array($v)) {
                $this->attrs[$v] = $aid;
            }

            $this->attr_idx[$aid] = $v; // ids for this attr
        }
        foreach ($iax as $atn => $v) {
            if (!$v) {
                unset($iax[$atn]);
            }
        }

        $this->idx_attr = $iax;
        $this->attribs  = $aix;

        return $this->attr_idx;
    }
1016036
public function buildAttrs(array $attrs = array())
    {
        $result = ' ';
        foreach ($attrs as $key => $param) {
            $param = (array) $param;
            if ($key === 'data') {
                $result .= $this->_buildDataAttrs($param);
                continue;
            }

            $value = implode(' ', $param);
            $value = $this->_cleanValue($value);

            if ($key !== 'data' && $attr = $this->_buildAttr($key, $value)) {
                $result .= $attr;
            }
        }

        return trim($result);
    }
428833
protected function attributes($attributes)
    {
        if (!is_array($attributes)) {
            return $attributes;
        }

        $attr = '';
        foreach ($attributes as $attribute => $value) {
            if (is_int($attribute)) {
                $attribute = $value;
            }
            $attr .= ' ' . $attribute . '="' . $value . '"';
        }

        return $attr;
    }
1361059
public static function newRow(array $attrs = array()) {
        if (!empty(self::$row_data))
            self::$rows[count(self::$rows) - 1][] = self::$row_data;
        self::$row_data = array();
        self::$rows[][] = $attrs;
        return count(self::$rows);
    }
774812
public function setAttributes(array $attrs) {

		foreach($attrs as $k => $v) {
			$this->setAttribute($k, $v);
		}

		return $this;

	}
603164
protected function getPriorityFromAttributes($attrs)
    {
        if (!is_array($attrs) || !isset($attrs['priority'])) {
            return 0;
        }
        $p = intval($attrs['priority']);

        return $p < 0 ? 0 : $p;
    }
689190
public function updateAttributes($attrs)
    {
        $cls     = $this->_cls;
        $table   = $this->_builder->table;
        $where   = $this->_builder->where;
        $escape  = Driver::$escape_char;

        $sql   = "update $escape$table$escape set ";
        $sql  .= $cls::extractUpdateColumns($attrs, ",");
        $vals  = $cls::extractWhereValues($attrs);

        if (!empty($where)) {
            $sql .= " where $where";
        }
        $nval = array_merge($vals, is_array($this->_vals) ? $this->_vals : array());
        return $cls::executePrepared($sql, $nval);
    }
160453
protected function attributes($attributes = [])
    {
        $ar = [];

        foreach ($attributes as $key => $value) {
            $element = $this->attribute($key, $value);
            if (!is_null($element)) {
                $ar[] = $element;
            }
        }

        return count($ar) > 0 ? ' '.implode(' ', $ar) : '';
    }
607305
public function setAttrs($attrs)
    {
        $oldAttrs = $this->attributes;
        $oldClasses = $this->classes;

        $this->attributes = $attrs;
        $this->attributes = Generator::parseAtts($this);

        $this->attributes = array_merge($oldAttrs, $this->attributes);
        $this->classes = null;
        $this->update('classes');

        if (!empty($oldClasses) && !empty($this->classes)) {
            $this->attributes['class'] = implode(' ', array_merge($oldClasses, $this->classes));
        }
        $this->classes = null;

        if (!empty($oldAttrs['style']) && !empty($this->attributes['style'])) {
            $this->attributes['style'] = Generator::mergeStyles($this->attributes['style'], $oldAttrs['style']);
        }

        $this->update();
    }
409169
private function createCheckboxNode(array $attrs)
    {
        $defaults = array(
            'type' => 'checkbox',
            'value' => '1'
        );

        $attrs = array_merge($defaults, $attrs);

        $node = new NodeElement();
        $node->openTag('input')
             ->addAttributes($attrs);

        // Check if active
        if ($this->active == $defaults['value'] || $this->active === true) {
            $node->addProperty('checked');
        }

        $node->finalize(true);

        return $node;
    }
356889
public function prepare(&$attrs)
    {
        parent::prepare($attrs);

        $attrs['max'] = $this->getAttribute('max');
        $attrs['min'] = $this->getAttribute('min');
        $attrs['step'] = $this->getAttribute('step');
        $attrs['patten'] = $this->getAttribute('pattern');
    }
1003076
public function assign($attrs)
    {
        foreach ($attrs as $key => $val) {
            if (property_exists($this, $key)) {
                $this->$key = $val;
            }
        }
    }
451673
private function appendAttributes(array $attrs)
    {
        foreach ($attrs as $key => $value) {
            $this->appendAttribute($key, $value);
        }
    }
647436
protected function _buildAttribute($attr)
    {
        $string = array();

        foreach ($attr as $key => $value) {
            if (is_array($value)) {
                $value = implode(' ', $value);
            }

            $string[] = $key.'="'.$value.'"';
        }

        return implode(' ', $string);
    }
100156
public function buildInput($attrs)
    {
        $content = $this->getAttribute('content');

        if (is_callable($content)) {
            return call_user_func($content, $this);
        }

        return $content;
    }
506032
public function attribute( $attrIds )
	{
		if( !empty( $attrIds ) ) {
			$this->conditions[] = $this->filter->compare( '==', 'attribute.id', $attrIds );
		}

		return $this;
	}
889130
public function withAttributes(Attributes $attribs): self
    {
        $obj = clone $this;
        $obj->_attributes = $attribs;
        return $obj;
    }