mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-04 17:04:53 +02:00
28 lines
No EOL
612 B
PHP
28 lines
No EOL
612 B
PHP
<?php
|
|
|
|
namespace App\Twig;
|
|
|
|
use Twig\Extension\AbstractExtension;
|
|
use Twig\TwigFilter;
|
|
|
|
class AppExtension extends AbstractExtension
|
|
{
|
|
public function getFilters()
|
|
{
|
|
return [
|
|
new TwigFilter('repeat', [$this, 'repeatFilter']),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Repeats a string a specified number of times
|
|
*
|
|
* @param string $string The string to repeat
|
|
* @param int $times The number of times to repeat the string
|
|
* @return string The repeated string
|
|
*/
|
|
public function repeatFilter($string, $times)
|
|
{
|
|
return str_repeat($string, $times);
|
|
}
|
|
} |