BridgeTwigExtension.php 778B

12345678910111213141516171819202122232425262728293031323334353637
  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. );
  19. }
  20. public function getFilters()
  21. {
  22. return [
  23. ];
  24. }
  25. public function getDayByNumber($number)
  26. {
  27. return $this->utils->getDayByNumber($number) ;
  28. }
  29. }