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:
parent
c36e43e249
commit
d8ede3263f
15 changed files with 365 additions and 28 deletions
module/Core/functions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue