TransformationsExtension.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * hold PhpMyAdmin\Twig\TransformationsExtension class
  5. *
  6. * @package PhpMyAdmin\Twig
  7. */
  8. declare(strict_types=1);
  9. namespace PhpMyAdmin\Twig;
  10. use PhpMyAdmin\Transformations;
  11. use Twig\Extension\AbstractExtension;
  12. use Twig\TwigFunction;
  13. /**
  14. * Class TransformationsExtension
  15. *
  16. * @package PhpMyAdmin\Twig
  17. */
  18. class TransformationsExtension extends AbstractExtension
  19. {
  20. /**
  21. * Returns a list of functions to add to the existing list.
  22. *
  23. * @return TwigFunction[]
  24. */
  25. public function getFunctions()
  26. {
  27. $transformations = new Transformations();
  28. return [
  29. new TwigFunction(
  30. 'get_description',
  31. [
  32. $transformations,
  33. 'getDescription',
  34. ]
  35. ),
  36. new TwigFunction(
  37. 'get_name',
  38. [
  39. $transformations,
  40. 'getName',
  41. ]
  42. ),
  43. ];
  44. }
  45. }