Upgrade Kirby from 4.3.0 to 4.4.0

This commit is contained in:
Timothée Goguely 2024-09-12 17:37:56 +02:00
parent 03905dbd83
commit 3bed01af75
293 changed files with 54254 additions and 187 deletions

View file

@ -738,12 +738,18 @@ class A
/**
* Returns a number of random elements from an array,
* either in original or shuffled order
*
* @throws \Exception When $count is larger than array length
*/
public static function random(
array $array,
int $count = 1,
bool $shuffle = false
): array {
if ($count > count($array)) {
throw new InvalidArgumentException('$count is larger than available array items');
}
if ($shuffle === true) {
return array_slice(self::shuffle($array), 0, $count);
}