You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 line
975B

  1. <?php
  2. namespace Lc\ShopBundle\Twig;
  3. use Lc\ShopBundle\Services\Utils;
  4. use Twig\Extension\AbstractExtension;
  5. use Twig\TwigFilter;
  6. use Twig\TwigFunction;
  7. class BridgeTwigExtension extends AbstractExtension
  8. {
  9. private $utils ;
  10. public function __construct(Utils $utils)
  11. {
  12. $this->utils = $utils ;
  13. }
  14. public function getFunctions()
  15. {
  16. return array(
  17. new TwigFunction('getDayByNumber', [$this, 'getDayByNumber']),
  18. new TwigFunction('getUnitsList', [$this, 'getUnitsList']),
  19. );
  20. }
  21. public function getFilters()
  22. {
  23. return [
  24. ];
  25. }
  26. public function getDayByNumber($number)
  27. {
  28. return $this->utils->getDayByNumber($number) ;
  29. }
  30. public function getUnitsList()
  31. {
  32. return $this->utils->getUnitsList() ;
  33. }
  34. }