1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * (c) FSi sp. z o.o. <[email protected]> |
||||
5 | * |
||||
6 | * For the full copyright and license information, please view the LICENSE |
||||
7 | * file that was distributed with this source code. |
||||
8 | */ |
||||
9 | |||||
10 | declare(strict_types=1); |
||||
11 | |||||
12 | namespace FSi\Bundle\AdminBundle\Twig; |
||||
13 | |||||
14 | use FSi\Bundle\AdminBundle\Message\FlashMessages; |
||||
15 | use Twig_Extension; |
||||
16 | use Twig_SimpleFunction; |
||||
17 | |||||
18 | class MessageTwigExtension extends Twig_Extension |
||||
0 ignored issues
–
show
Deprecated Code
introduced
by
![]() |
|||||
19 | { |
||||
20 | /** |
||||
21 | * @var FlashMessages |
||||
22 | */ |
||||
23 | private $flashMessages; |
||||
24 | |||||
25 | public function __construct(FlashMessages $flashMessages) |
||||
26 | { |
||||
27 | $this->flashMessages = $flashMessages; |
||||
28 | } |
||||
29 | |||||
30 | public function getFunctions(): array |
||||
31 | { |
||||
32 | return [ |
||||
33 | new Twig_SimpleFunction('fsi_admin_messages', [$this, 'getMessages']), |
||||
0 ignored issues
–
show
The class
Twig_SimpleFunction has been deprecated: since Twig 2.7, use "Twig\TwigFunction" instead
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
34 | ]; |
||||
35 | } |
||||
36 | |||||
37 | public function getMessages(): array |
||||
38 | { |
||||
39 | return $this->flashMessages->all(); |
||||
40 | } |
||||
41 | |||||
42 | public function getName(): string |
||||
43 | { |
||||
44 | return 'fsi_admin_messages'; |
||||
45 | } |
||||
46 | } |
||||
47 |