mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-05 23:03:11 +08:00
Implement command to manage redirect rules for a short URL
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user