vendor/php-flasher/flasher-symfony/Twig/FlasherTwigExtension.php line 14

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the PHPFlasher package.
  4.  * (c) Younes KHOUBZA <younes.khoubza@gmail.com>
  5.  */
  6. namespace Flasher\Symfony\Twig;
  7. use Flasher\Prime\FlasherInterface;
  8. use Flasher\Symfony\Bridge\Twig\FlasherTwigExtension as BaseFlasherTwigExtension;
  9. use Twig\TwigFunction;
  10. final class FlasherTwigExtension extends BaseFlasherTwigExtension
  11. {
  12.     /**
  13.      * @var FlasherInterface
  14.      */
  15.     private $flasher;
  16.     public function __construct(FlasherInterface $flasher)
  17.     {
  18.         $this->flasher $flasher;
  19.     }
  20.     /**
  21.      * @return TwigFunction[]
  22.      */
  23.     public function getFlasherFunctions()
  24.     {
  25.         $options = array('is_safe' => array('html'));
  26.         return array(
  27.             new TwigFunction('flasher_render', array($this'render'), $options),
  28.         );
  29.     }
  30.     /**
  31.      * @param array<string, mixed> $criteria
  32.      *
  33.      * @return string
  34.      */
  35.     public function render(array $criteria = array())
  36.     {
  37.         return $this->flasher->render($criteria'html'); // @phpstan-ignore-line
  38.     }
  39. }