Overwrites merge method. Check if procteded are added


@param array $items
@param boolean $recursive
@return self
425667
public function merge(array $items, $recursive = false)
    {
        foreach ($items as $key => $value)
        {
            $this->set($key, $value);
        }

        return $this;
    }
496758
public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self
    {
        if ($recursive === true) {
            $result = \array_replace_recursive($this->getArray(), $array);
        } else {
            $result = \array_replace($this->getArray(), $array);
        }

        return static::create(
            $result,
            $this->iteratorClass,
            false
        );
    }
488741
protected function merge( $items, $mergeAdded = false )
    {
        $itemObjects = array();
        foreach ( $items as $item )
        {
            $oid = $item['object_id'];
            $itemObjects[$oid] = new eZPageBlockItem( $item, false );
        }

        if ( isset( $this->attributes['items'] ) && $this->attributes['items'] )
        {
            foreach ( $this->attributes['items'] as $item )
            {
                $oid = $item->attribute( 'object_id' );
                if ( $item->toBeRemoved() )
                {
                    unset( $itemObjects[$oid] );
                }
                if ( $mergeAdded && $item->toBeAdded() )
                {
                    $itemObjects[$oid] = $item;
                }
                if ( $item->toBeModified() )
                {
                    if ( isset( $itemObjects[$oid] ) )
                    {
                        //modify an item in history to be visible
                        //if item from db is hidden, visible=0 and the item from draft is not, delete it from db queue
                        //this is the case when requesting the history items and valid item
                        if( $item->attribute( 'ts_hidden' ) == 0 && $item->attribute( 'ts_visible' ) == 0 )
                        {
                            if( !$mergeAdded )
                            {
                                unset( $itemObjects[$oid] );
                            }
                        }
                        else
                        {
                            //this is the case when fetching valid items
                            $itemObjects[$oid]->setAttribute( 'ts_publication', $item->attribute( 'ts_publication' ) );
                            $itemObjects[$oid]->setAttribute( 'priority', $item->attribute( 'priority' ) );
                        }
                    }
                    else
                    {
                        //modify an item in history to be visible
                        //if the items from db don't have the item
                        //and modified item is not hidden, add it to the item list.
                        //this is the case when requesting the queue
                        if( $item->attribute( 'ts_hidden' ) == 0 && $item->attribute( 'ts_visible' ) == 0)
                        {
                            if( $mergeAdded )
                            {
                                $itemObjects[$oid] = $item;
                            }
                        }
                    }
                }
            }
        }

        return $itemObjects;
    }
90894
public function merge( array ...$array_to_merge ) : self {

		foreach ( $array_to_merge as $arr ) {
			$items = array_replace_recursive( $this->getArrayCopy(), $arr );

			foreach ( $items as $key => $value ) {
				$this->offsetSet( $key, $value );
			}
		}

		return $this;
	}
1325511
public function addItems(array $items, $append = true)
    {
        $this->_items = $this->mergeItems($this->_items, $items, $append);
    }
871578
public function mergeMenus(array $items)
    {
        foreach ($items as $item) {
            $menu = Yii::createObject($item['menu']);
            $this->mergeItems($menu->getItems());
        }
    }
857445
public function replace(array $items): self {
        foreach ($items as $key => $value) {
            $this->has($key) && $this->set($key, $value);
        }
        return $this;
    }
265106
public function addItems( array $items, $index = null ) {
		foreach ( $items as $item ) {
			// Check if item exists then remove it first, effectively "moving" it
			$currentIndex = array_search( $item, $this->items, true );
			if ( $currentIndex !== false ) {
				$this->removeItems( [ $item ] );
				// Adjust index to compensate for removal
				if ( $currentIndex < $index ) {
					$index--;
				}
			}
			// Add the item
			$item->setElementGroup( $this );
		}

		if ( $index === null || $index < 0 || $index >= count( $this->items ) ) {
			$this->items = array_merge( $this->items, $items );
		} else {
			array_splice( $this->items, $index, 0, $items );
		}

		// Update actual target element contents to reflect our list
		$this->group->clearContent();
		$this->group->appendContent( $this->items );

		return $this;
	}
172720
public function addAll(array $items) : Set
    {
        $values = $this->_pushAll($items);
        $this->setValues($values);
        return $this;
    }
620017
public static function merge_data_recursive($a, $b)
    {
        $args = func_get_args();
        $t = $args[0];
        $array = is_array($t);

        foreach ($args as $k => $a) {
            $args[$k] = self::ar($a, null, true);
        }

        $args = call_user_func_array('array_merge_recursive', $args);
        
        if (!$array) {
            $args = self::sc($args, null, true);
        }

        return $args;
    }
548655
public function merge(MenuItemCollection $items)
    {
        foreach ($items->getItems() as $name => $item) {
            $this->set($name, $item);
        }

        return $this;
    }
83252
public static function mergeNodes($items1, $items2)
    {
        $ret = array();
        $items = array_merge($items1, $items2);
        $len = count($items);

        // collects non-repeated elements
        for ($i = 0; $i < $len; $i++) {
            $item = $items[$i];
            $position = Dom::searchNode($item, $items, $i + 1);
            if ($position === false) {
                array_push($ret, $item);
            }
        }
        
        return $ret;
    }
962158
public function append($items)
	{
		foreach( (array) $items as $key => $item ) 
		{
			array_push($this->attributes, $item);
		}

		return $this;
	}
1041980
public function addChildren($items)
    {
        $manager = Configs::authManager();
        $success = 0;
        if ($this->_item) {
            foreach ($items as $name) {
                $child = $manager->getPermission($name);
                if ($this->type == Item::TYPE_ROLE && $child === null) {
                    $child = $manager->getRole($name);
                }
                try {
                    $manager->addChild($this->_item, $child);
                    $success++;
                } catch (\Exception $exc) {
                    Yii::error($exc->getMessage(), __METHOD__);
                }
            }
        }
        if ($success > 0) {
            Helper::invalidate();
        }
        return $success;
    }
221594
public function setItems(array $items)
    {
        $this->content = new HtmlElements();

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

        return $this;
    }
711775
public function addMany($items, $prepend = false)
    {
        $this->emitOnChange(__METHOD__);
        if ($prepend) {
            # if items must be added to beginning, we need to reverse them
            if (!is_array($items)) {
                $items = iterator_to_array($items);
            }
            $items = array_reverse($items);
        }
        foreach ($items as $item) {
            $this->add($item, $prepend);
        }
        $this->endEmitOnChange(__METHOD__);
        return $this;
    }
244115
public function delete(bool $recursive = true): bool
    {
        $this->each(function (AbstractObject $item) use ($recursive) {
            if ($item->isFolder()) {
                $item->delete($recursive);
            } else {
                $item->delete();
            }
        });

        return true;
    }