[UTIL][Functional] Update Functional::cartesian_product to pass an array of collections first and a separator after
This commit is contained in:
parent
0050371de7
commit
7aa90954eb
@ -32,12 +32,16 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace App\Util;
|
namespace App\Util;
|
||||||
|
|
||||||
|
use Stringable;
|
||||||
|
|
||||||
abstract class Functional
|
abstract class Functional
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* TODO replace with \Functional\cartesian_product when it gets merged upstream
|
* TODO replace with \Functional\cartesian_product when it gets merged upstream
|
||||||
|
*
|
||||||
|
* @param array<array<string|Stringable>> $collections
|
||||||
*/
|
*/
|
||||||
public static function cartesianProduct(string|array $separator, ...$collections)
|
public static function cartesianProduct(array $collections, string|array $separator = ''): array
|
||||||
{
|
{
|
||||||
$aggregation = [];
|
$aggregation = [];
|
||||||
$left = array_shift($collections);
|
$left = array_shift($collections);
|
||||||
|
Loading…
Reference in New Issue
Block a user