mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-09 17:02:46 +02:00
28 lines
612 B
PHP
28 lines
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);
|
||
|
}
|
||
|
}
|