Inserts items inside of array.
rough method: unset and then set, think of better.
@param array        $array source array
@param array        $items array of items
@param string|array $where where to insert
@return array new items list
@see add()
545098
public static function insertInside(array $array, $items, $where)
    {
        foreach ($items as $k => $v) {
            unset($array[$k]);
        }
        $before = self::prepareWhere($array, isset($where['before']) ? $where['before'] : null);
        $after  = self::prepareWhere($array, isset($where['after']) ? $where['after'] : null);
        $new    = [];
        $found  = false;
        /// TODO think of realizing it better
        foreach ($array as $k => $v) {
            if (!$found && $k === $before) {
                foreach ($items as $i => $c) {
                    $new[$i] = $c;
                }
                $found = true;
            }
            $new[$k] = $v;
            if (!$found && $k === $after) {
                foreach ($items as $i => $c) {
                    $new[$i] = $c;
                }
                $found = true;
            }
        }
        if (!$found) {
            foreach ($items as $i => $c) {
                $new[$i] = $c;
            }
        }

        return $new;
    }
896809
public function addFooter($items)
    {
        if (! is_array($items)) {
            $items = func_get_args();
        }

        $this->addElement(new Footer($items));

        return $this;
    }
2225
public function merge(array $items)
    {
        $this->items = $this->arrayMergeRecursive($this->items, $items);
        $this->nestedKeyCache = [];
    }
1366525
public function removeAll(array $items) : Set
    {
        $values = $this->_removeSameAll($items);
        $this->setValues($values);
        return $this;
    }
1336052
private function _build_items(array $items)
	{
		foreach ($items as $key => $item) {
			$this->_items[$key] = new Element_Item($item, $this, $key);
		}

		return $this;
	}
949718
public function add(array $items) {
		
		foreach($items as $name => $object) {
			$this->set($name, $object);
		}
		
		return $this;
	}
544939
public function add(array $items, $allowNumericitem = false)
    {
        foreach ($items as $item => $_deps) {
            if (! $allowNumericitem and is_int($item)) {
                $this->addItem($_deps);
            } else {
                $this->addItem($item, $_deps);
            }
        }
    }
221594
public function setItems(array $items)
    {
        $this->content = new HtmlElements();

        foreach ($items as $item) {
            $this->addItem($item);
        }

        return $this;
    }
1104195
public static function insert($array, $values, $index = null)
    {
        $values = (array) AnConfig::unbox($values);
        $array = (array) AnConfig::unbox($array);
        if ($index === null) {
            foreach ($values as $value) {
                array_push($array, $value);
            }
        } else {
            array_splice($array, $index, 0, $values);
        }

        return $array;
    }
948288
public function addWhere(array $where): void
    {
        if (empty($where)) {
            return;
        }

        $firstClause = true;
        $this->statement .= ' WHERE ';
        foreach ($where as $clause) {
            if ($firstClause === false) {
                $this->statement .= ' ' . $clause['concatenator'] . ' ';
            }
            switch ($clause['operator']) {
                case 'IN':
                    $this->addWhereIn($clause['key'], $clause['value'], false);
                    break;
                case 'NOT IN':
                    $this->addWhereIn($clause['key'], $clause['value'], true);
                    break;
                case 'BETWEEN':
                    $this->addWhereBetween($clause['key'], $clause['value']['min'], $clause['value']['max']);
                    break;
                case 'NULL':
                    $this->addWhereNull($clause['key'], false);
                    break;
                case 'NOT NULL':
                    $this->addWhereNull($clause['key'], true);
                    break;
                default:
                    $this->addSimpleWhere($clause['key'], $clause['operator'], $clause['value']);
                    break;
            }

            $firstClause = false;
        }
    }
1051378
public function addItems($items = null, $attribs = [])
    {
        $this->configure(
            $items,
            function (KeyValueGrid $grid, $key, $value) use ($attribs) {
                $grid->addItem($key, $value, $attribs);
            }
        );

        return $this;
    }
924796
public function addMultiple(array $items)
    {
        foreach ($items as $item) {
            if ($item instanceof RequestException) {
                $this->addException($item);
            } else {
                $this->addResponse($item);
            }
        }
    }
920845
public function update(array $data, array $where)
    {
        if (!$where) {
            die ('Where is required');
        }

        if (!$data) {
            die ('Data is required');
        }

        return $this->_update($data, $where);
    }
1356831
public function putItems(array $items)
    {
        foreach ($items as $k => $v) {
            $this->putItem($k, $v);
        }
    }
156042
public function push(... $items) : ArrayList
    {
        $values = $this->_pushAll($items);
        $this->setValues($values);
        return $this;
    }
246835
public function insertArray(array $items)
    {
        foreach ($items as $priority => $item) {
            $this->insert($item, $priority);
        }

        return $this;
    }
18646
private function build_where(array $where_array){
        $where_clause = [];
        $counter = 0;
        foreach( $where_array as list($glue, $where) ){
            if( $counter ){
                $where_clause[] = $glue;
            }
            if( is_array($where) ){
                $where_clause[] = $this->build_where($where_array);
            }else{
                $where_clause[] = sprintf('(%s)', $where);
            }
            $counter++;
        }
        return sprintf('(%s)', implode(' ', $where_clause));
    }