public function combine(iterable $values, bool $inPlace = false): self
    {
        if (count($values) != count($this->items)) {
            $this->doThrow(
                'Invalid input for '.($inPlace ? 'replace' : 'combine').', number of items does not match.',
                Factory::getArrayForItems($values)
            );
        }
        $values = Factory::getArrayForItems($values);

        return Factory::create(array_combine($this->items, $values));
    }
public function combine(iterable $values, bool $inPlace = false): self
    {
        if (count($values) != count($this->items)) {
            $this->doThrow(
                'Invalid input for '.($inPlace ? 'replace' : 'combine').', number of items does not match.',
                Factory::getArrayForItems($values)
            );
        }
        $values = Factory::getArrayForItems($values);

        return Factory::create(array_combine($this->items, $values));
    }
public function combine ( iterable $ values , bool $ inPlace = false ) : self { if ( count ( $ values ) != count ( $ this -> items ) ) { $ this -> doThrow ( 'Invalid input for ' . ( $ inPlace ? 'replace' : 'combine' ) . ', number of items does not match.' , Factory :: getArrayForItems ( $ values ) ) ; } $ values = Factory :: getArrayForItems ( $ values ) ; return Factory :: create ( array_combine ( $ this -> items , $ values ) ) ; }
Combine and return a new Collection.
It takes the keys of the current Collection and assign the values.

@performanceCompared true
Combine and return a new Collection . It takes the keys of the current Collection and assign the values .