rosavox/source/nav.php

42 lines
617 B
PHP

<?php
namespace rosavox;
require_once('helpers/list.php');
require_once('helpers/string.php');
require_once('helpers/misc.php');
/**
*/
function make_link(string $mode, array $args) : string
{
$a = \array_merge($args, ['mode' => $mode]);
return (
'?'
.
\implode(
'&',
\rosavox\helpers\list_\map(
\array_keys($a),
fn ($key) => \rosavox\helpers\string_\coin(
'{{key}}={{value}}',
[
'key' => $key,
'value' => $a[$key],
]
)
)
)
);
}
/**
*/
function nav(string $mode, array $args) : void
{
\rosavox\helpers\misc\navigate(make_link($mode, $args));
}
?>