src/Twig/ContactsExtension.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Twig;
  3. use App\Services\Core\Contacts;
  4. use Twig\Extension\AbstractExtension;
  5. use Twig\TwigFunction;
  6. use Twig\TwigFilter;
  7. class ContactsExtension extends AbstractExtension
  8. {
  9.     public function __construct(Contacts $contacts)
  10.     {
  11.         $this->contacts $contacts;
  12.     }
  13.     /**
  14.      * {@inheritdoc}
  15.      */
  16.     public function getFunctions(): array
  17.     {
  18.         return [
  19.             new  TwigFunction('getContactsFormValue', [$this'getContactsFormValue']),
  20.             new  TwigFunction('getCountLeads', [$this'getCountLeads']),
  21.         ];
  22.     }
  23.     public function getContactsFormValue($sessionID,$identifiant)
  24.     {
  25.         return $this->contacts->getValue($sessionID,$identifiant);
  26.     }
  27.     public function getCountLeads()
  28.     {
  29.         return $this->contacts->getLeads();
  30.     }
  31. }