/** * Reassembles a traversed sequence into its original shape * * Note that this only has an effect if the Sequenced data has the path-keyed * structure that results from a call to Sequence::traverse() * * @param string $pathSeparator The character used to parse the key path * @return static */ public function reassemble($pathSeparator = '.') { return static::make(IterationTraits::reassemble($this, $pathSeparator)); }
/** * Flatten a Sequence into a new Sequence. * * @param int $depth * @return static */ public function flatten($depth = -1) { $recursiveIterator = new RecursiveIteratorIterator(RecursiveSequence::make($this)->setMaxDepth($depth)); // Simulate array_merge by sequencing numeric keys but do not touch string keys. return static::make(IterationTraits::sequenceNumericKeys(Sequence::make($recursiveIterator))); }