TemplateReferenceInterface.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Templating;
  11. /**
  12. * Interface to be implemented by all templates.
  13. *
  14. * @author Victor Berchet <victor@suumit.com>
  15. *
  16. * @api
  17. */
  18. interface TemplateReferenceInterface
  19. {
  20. /**
  21. * Gets the template parameters.
  22. *
  23. * @return array An array of parameters
  24. *
  25. * @api
  26. */
  27. public function all();
  28. /**
  29. * Sets a template parameter.
  30. *
  31. * @param string $name The parameter name
  32. * @param string $value The parameter value
  33. *
  34. * @return TemplateReferenceInterface The TemplateReferenceInterface instance
  35. *
  36. * @throws \InvalidArgumentException if the parameter is not defined
  37. *
  38. * @api
  39. */
  40. public function set($name, $value);
  41. /**
  42. * Gets a template parameter.
  43. *
  44. * @param string $name The parameter name
  45. *
  46. * @return string The parameter value
  47. *
  48. * @throws \InvalidArgumentException if the parameter is not defined
  49. *
  50. * @api
  51. */
  52. public function get($name);
  53. /**
  54. * Returns the path to the template.
  55. *
  56. * By default, it just returns the template name.
  57. *
  58. * @return string A path to the template or a resource
  59. *
  60. * @api
  61. */
  62. public function getPath();
  63. /**
  64. * Returns the "logical" template name.
  65. *
  66. * The template name acts as a unique identifier for the template.
  67. *
  68. * @return string The template name
  69. *
  70. * @api
  71. */
  72. public function getLogicalName();
  73. }