TemplateReferenceInterface.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. interface TemplateReferenceInterface
  17. {
  18. /**
  19. * Gets the template parameters.
  20. *
  21. * @return array An array of parameters
  22. */
  23. public function all();
  24. /**
  25. * Sets a template parameter.
  26. *
  27. * @param string $name The parameter name
  28. * @param string $value The parameter value
  29. *
  30. * @return TemplateReferenceInterface The TemplateReferenceInterface instance
  31. *
  32. * @throws \InvalidArgumentException if the parameter name is not supported
  33. */
  34. public function set($name, $value);
  35. /**
  36. * Gets a template parameter.
  37. *
  38. * @param string $name The parameter name
  39. *
  40. * @return string The parameter value
  41. *
  42. * @throws \InvalidArgumentException if the parameter name is not supported
  43. */
  44. public function get($name);
  45. /**
  46. * Returns the path to the template.
  47. *
  48. * By default, it just returns the template name.
  49. *
  50. * @return string A path to the template or a resource
  51. */
  52. public function getPath();
  53. /**
  54. * Returns the "logical" template name.
  55. *
  56. * The template name acts as a unique identifier for the template.
  57. *
  58. * @return string The template name
  59. */
  60. public function getLogicalName();
  61. /**
  62. * Returns the string representation as shortcut for getLogicalName().
  63. *
  64. * Alias of getLogicalName().
  65. *
  66. * @return string The template name
  67. */
  68. public function __toString();
  69. }