Set multiple hash fields to multiple values

@param  string $collection
@param  string $key
352264
public function hmset($key) {

        $set     = $this->getKey($collection, $key, []);
        $args    = func_get_args();

        for ($i=1; $i<count($fields); $i++){
            $field = $args[$i];
            $value = isset($args[($i+1)]) ? $args[($i+1)] : null;

            $set[$field] = $value;
            $i = $i + 1;
        }

        $this->setKey($collection, $key, $set);
    }
1037757
public static <K, V> void putSetMult(Map<K, Set<V>> map, K key,
            Collection<? extends V> values) {
        for (V value : values) {
            putSet(map, key, value);
        }
    }
1021463
protected function setOnField(FieldCollection $field, $value)
    {
        if (!is_array($value)) {
            if ($field->getMaxItems() != 1) {
                throw new MultipleFieldAssignmentException('You cannot assign a value to replace a multiple field');
            }

            $field->offsetSet(static::$SINGLE_ITEM_KEY, $value);

            return;
        }

        $field->clear();

        // This happens when the array is
        // replaced completely by another array
        if (count($value)) {
            foreach ($value as $k => $v) {
                $field->offsetSet($k, $v);
            }
        }
    }
53317
protected function collection_query( &$collection ) 
	{
		$local_keys = array();
		
		foreach( $collection as $item )
		{
			$local_keys[] = $item->raw( $this->local_key );
		}
		
		// set the correct collection where
		$this->query->wheres = array();
		$this->query->where( $this->foreign_key, 'in', $local_keys );
		$this->query->group_result( $this->foreign_key );
		
		$this->query->limit( null );
	}
1312354
public function offsetSet($key, $entity)
    {
        $class = $this->entityClass;

        if ($entity instanceof $class) {
            if (!isset($key)) {
                $this->entities[] = $entity;
            } else {
                $this->entities[$key] = $entity;
            }
            return true;
        }

        throw new CollectionException(
            'The specified entity is not allowed for this collection.'
        );
    }
676438
public function setCollection($collection)
    {
        //Argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        if ($collection != self::COLLECTION
        && !is_subclass_of($collection, self::COLLECTION)) {
            Exception::i()
                ->setMessage(Exception::NOT_SUB_COLLECTION)
                ->addVariable($collection)
                ->trigger();
        }
        
        $this->collection = $collection;
        return $this;
    }
88302
public function hmSet($key, $fields)
    {
        $this->log(__FUNCTION__, $key);
        return $this->persistence->hmSet($key, $fields);
    }
392449
public function setKey($collection, $key, $value) {

        $entry = $this->driver->findOne($collection, ['key' => $key]);

        if ($entry) {
            $entry['val'] = $value;
        } else {
            $entry = [
                'key' => $key,
                'val' => $value
            ];
        }

        return $this->driver->save($collection, $entry);
    }
1200187
function copyto($key) {
		$var=&\Base::instance()->ref($key);
		foreach ($this->fields+$this->adhoc as $key=>$field)
			$var[$key]=$field['value'];
	}
1155346
private function AddCookieToConfig($collection)
	{
		foreach($collection as $key => $value)
		{
			$this->addPairToConfig('cookie.' . $key, $value);
		}
	}
5119
private function mergeRootCollection(&$collection, $object)
    {
        if (is_array($object)) {
            foreach ($object as $resource) {
                $this->addResourceToRootCollectionIfNonExistant($collection, $resource);
            }
        } elseif ($object instanceof Collection) {
            $object->each(function ($resource) use (&$collection) {
                $this->addResourceToRootCollectionIfNonExistant($collection, $resource);
            });
        }
    }
1021094
public function prependSet($key, $value): ArrayCollection
    {
        $this->items = [$key => $value] + $this->items;

        return $this;
    }
1367945
public function merge($collection, $preserveKeys = true)
    {
        foreach($collection as $key => $value) {
            $preserveKeys ? $this->_data[$key] = $value : $this->_data[] = $value;
        }
        return $this;
    }
639074
public function hasKey($key, $collection)
    {
        if (empty($this->queriesResultCache[ 'collectionKeys' ][ $collection ])) {
            $this->getKeys($collection);
        }

        return (bool)in_array($key, $this->queriesResultCache[ 'collectionKeys' ][ $collection ]);
    }
1287673
public static function universalSet($collection, $key, $value)
    {
        $set_object = function ($object, $key, $value) {
            $newObject = clone $object;
            $newObject->$key = $value;

            return $newObject;
        };
        $set_array = function ($array, $key, $value) {
            $array[$key] = $value;

            return $array;
        };
        $setter = __::isObject($collection) ? $set_object : $set_array;

        return call_user_func_array($setter, [$collection, $key, $value]);
    }
140845
protected function addExpectedMocksCollection($key, array $collection)
    {
        if (isset($this->expectedMocks[$key]) || isset($this->expectedMocksCollections[$key]) || isset($this->expectedValues[$key])) {
            throw new \LogicException(
                sprintf('The expected mocks collection "%s" you are trying to add is already set as mock, mock collection or value.', $key)
            );
        }

        foreach ($collection as $mock) {
            if (false === $mock instanceof \PHPUnit_Framework_MockObject_MockObject) {
                throw new \InvalidArgumentException(
                    sprintf('One of the elements in the mocks collection "%s" is not a mock object.', $key)
                );
            }
        }

        $this->expectedMocksCollections[$key] = $collection;

        return $this;
    }
1184170
public function setMany(array $collection)
    {
        foreach ($collection as $key => $value) {
            $this->set($key, $value);
        }

        return $this;
    }