| Code Coverage | ||||||||||
| Lines | Functions and Methods | Classes and Traits | ||||||||
| Total |  | 100.00% | 6 / 6 |  | 100.00% | 3 / 3 | CRAP |  | 100.00% | 1 / 1 | 
| Uuid |  | 100.00% | 6 / 6 |  | 100.00% | 3 / 3 | 3 |  | 100.00% | 1 / 1 | 
| getFunctions |  | 100.00% | 4 / 4 |  | 100.00% | 1 / 1 | 1 | |||
| getUuid |  | 100.00% | 1 / 1 |  | 100.00% | 1 / 1 | 1 | |||
| getUuidBy |  | 100.00% | 1 / 1 |  | 100.00% | 1 / 1 | 1 | |||
| 1 | <?php | 
| 2 | |
| 3 | declare(strict_types=1); | 
| 4 | |
| 5 | namespace Engelsystem\Renderer\Twig\Extensions; | 
| 6 | |
| 7 | use Engelsystem\Helpers\Uuid as UuidHelper; | 
| 8 | use Twig\Extension\AbstractExtension as TwigExtension; | 
| 9 | use Twig\TwigFunction; | 
| 10 | |
| 11 | class Uuid extends TwigExtension | 
| 12 | { | 
| 13 | /** | 
| 14 | * @return TwigFunction[] | 
| 15 | */ | 
| 16 | public function getFunctions(): array | 
| 17 | { | 
| 18 | return [ | 
| 19 | new TwigFunction('uuid', [$this, 'getUuid']), | 
| 20 | new TwigFunction('uuidBy', [$this, 'getUuidBy']), | 
| 21 | ]; | 
| 22 | } | 
| 23 | |
| 24 | public function getUuid(): string | 
| 25 | { | 
| 26 | return UuidHelper::uuid(); | 
| 27 | } | 
| 28 | |
| 29 | public function getUuidBy(mixed $value, ?string $name = null): string | 
| 30 | { | 
| 31 | return UuidHelper::uuidBy($value, $name); | 
| 32 | } | 
| 33 | } |