1
0
Fork 0
mirror of https://github.com/shlinkio/shlink.git synced 2025-05-07 15:55:30 +03:00

Implement command to manage redirect rules for a short URL

This commit is contained in:
Alejandro Celaya 2024-03-02 22:44:22 +01:00
parent c36e43e249
commit d8ede3263f
15 changed files with 365 additions and 28 deletions
module/Core/functions

View file

@ -72,3 +72,20 @@ function select_keys(array $array, array $keys): array
ARRAY_FILTER_USE_KEY,
);
}
/**
* @template T
* @template R
* @param iterable<T> $collection
* @param callable(T $value, string|number $key): R $callback
* @return R[]
*/
function map(iterable $collection, callable $callback): array
{
$aggregation = [];
foreach ($collection as $key => $value) {
$aggregation[$key] = $callback($value, $key);
}
return $aggregation;
}