Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
AppExtension
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 getFunctions
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getAvatarPath
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Twig;
4
5use Psr\Container\ContainerInterface;
6use Twig\Extension\AbstractExtension;
7use Twig\TwigFunction;
8
9class AppExtension extends AbstractExtension
10{
11//    public function __construct(private ContainerInterface $container)
12//    {
13//    }
14
15    public function getFunctions(): array
16    {
17        return [
18            new TwigFunction('avatar_asset', [$this, 'getAvatarPath'])
19        ];
20    }
21
22    public function getAvatarPath(string $path): string
23    {
24        return '/uploads/avatars/' . $path;
25    }
26
27}