<?php

declare(strict_types=1);

namespace App\Framework\View\Functions;

use App\Framework\Router\UrlGenerator;

final readonly class UrlFunction implements TemplateFunction
{
    public function __construct(
        private UrlGenerator $urlGenerator
    ) {
        $this->functionName = 'url';
    }

    public function __invoke(string $namedRoute, array $params = []): string
    {
        return $this->urlGenerator->route($namedRoute, $params);
    }

    public string $functionName;
}
