<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
danilovl / render-service-twig-extension-bundle example snippets
declare(strict_types=1);
namespace App\Application\Controller;
use Danilovl\RenderServiceTwigExtensionBundle\Attribute\AsTwigFunction;
#[AsTwigFunction('math_')]
class CountService
{
public function sum(int $one, int $two): int
{
return $one + $two;
}
public function min(int $one, int $two): int
{
return $one - $two;
}
public function multiplicationOperation(int $one, int $two): int
{
return $one * $two;
}
}
declare(strict_types=1);
namespace App\Application\Controller;
use Danilovl\RenderServiceTwigExtensionBundle\Attribute\{
AsTwigFilter,
AsTwigFunction
};
class RenderServiceController
{
#[AsTwigFunction('function_sum')]
public function twigFunctionSum(int $one, int $two): int
{
return $one + $two;
}
#[AsTwigFilter('filter_upper')]
public function twigFilterUpper(string $text): string
{
return strtoupper($text);
}
}