30 lines
525 B
PHP
Executable File
30 lines
525 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Twig;
|
|
|
|
use Ramsey\Uuid\Uuid;
|
|
use Twig\Extension\AbstractExtension;
|
|
use Twig\TwigFunction;
|
|
|
|
class AppExtension extends AbstractExtension
|
|
{
|
|
protected $container;
|
|
|
|
public function getFunctions()
|
|
{
|
|
return [
|
|
new TwigFunction('uniqueId', [$this, 'getUniqueId']),
|
|
];
|
|
}
|
|
|
|
public function getUniqueId()
|
|
{
|
|
return str_replace('-', '', Uuid::uuid4());
|
|
}
|
|
|
|
public function setContainer($container)
|
|
{
|
|
$this->container = $container;
|
|
}
|
|
}
|