$value) { $result = \str_replace(\sprintf('{{%s}}', $key), $value, $result); } return $result; } /** */ function render(string $template_name, array $arguments) : string { return string_coin( cache_get( string_coin( 'template.{{name}}', [ 'name' => $template_name, ] ), fn() => \file_get_contents( string_coin( '{{directory}}/templates/{{name}}.html.tpl', [ 'directory' => __DIR__, 'name' => $template_name, ] ) ) ), $arguments ); } /** */ function navigate(string $target) : void { \header('Location: ' . $target); } ?>