protected function get(array $dataset)
    {
        foreach ($dataset as $key => $firstItem) {
            $remaining = $dataset;

            \array_splice($remaining, $key, 1);

            if (0 === \count($remaining)) {
                yield [$firstItem];

                continue;
            }

            foreach ($this->get($remaining) as $permutation) {
                \array_unshift($permutation, $firstItem);
                yield $permutation;
            }
        }
    }
protected function get(array $dataset)
    {
        foreach ($dataset as $key => $firstItem) {
            $remaining = $dataset;

            \array_splice($remaining, $key, 1);

            if (0 === \count($remaining)) {
                yield [$firstItem];

                continue;
            }

            foreach ($this->get($remaining) as $permutation) {
                \array_unshift($permutation, $firstItem);
                yield $permutation;
            }
        }
    }
protected function get ( array $ dataset ) { foreach ( $ dataset as $ key => $ firstItem ) { $ remaining = $ dataset ; \ array_splice ( $ remaining , $ key , 1 ) ; if ( 0 === \ count ( $ remaining ) ) { yield [ $ firstItem ] ; continue ; } foreach ( $ this -> get ( $ remaining ) as $ permutation ) { \ array_unshift ( $ permutation , $ firstItem ) ; yield $ permutation ; } } }
The permutations generator.

@param array $dataset
The dataset

@codingStandardsIgnoreStart

@return \Generator
@codingStandardsIgnoreEnd
The permutations generator .