vendor/sensio/framework-extra-bundle/src/Configuration/Template.php line 20

Open in your IDE?
  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 Sensio\Bundle\FrameworkExtraBundle\Configuration;
  11. /**
  12. * The Template class handles the Template annotation parts.
  13. *
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. * @Annotation
  16. */
  17. class Template extends ConfigurationAnnotation
  18. {
  19. /**
  20. * The template.
  21. *
  22. * @var string
  23. */
  24. protected $template;
  25. /**
  26. * The associative array of template variables.
  27. *
  28. * @var array
  29. */
  30. private $vars = [];
  31. /**
  32. * Should the template be streamed?
  33. *
  34. * @var bool
  35. */
  36. private $streamable = false;
  37. /**
  38. * The controller (+action) this annotation is set to.
  39. *
  40. * @var array
  41. */
  42. private $owner = [];
  43. /**
  44. * Returns the array of templates variables.
  45. *
  46. * @return array
  47. */
  48. public function getVars()
  49. {
  50. return $this->vars;
  51. }
  52. /**
  53. * @param bool $streamable
  54. */
  55. public function setIsStreamable($streamable)
  56. {
  57. $this->streamable = $streamable;
  58. }
  59. /**
  60. * @return bool
  61. */
  62. public function isStreamable()
  63. {
  64. return (bool) $this->streamable;
  65. }
  66. /**
  67. * Sets the template variables.
  68. *
  69. * @param array $vars The template variables
  70. */
  71. public function setVars($vars)
  72. {
  73. $this->vars = $vars;
  74. }
  75. /**
  76. * Sets the template logic name.
  77. *
  78. * @param string $template The template logic name
  79. */
  80. public function setValue($template)
  81. {
  82. $this->setTemplate($template);
  83. }
  84. /**
  85. * Returns the template.
  86. *
  87. * @return string
  88. */
  89. public function getTemplate()
  90. {
  91. return $this->template;
  92. }
  93. /**
  94. * Sets the template.
  95. *
  96. * @param string $template The template
  97. */
  98. public function setTemplate($template)
  99. {
  100. $this->template = $template;
  101. }
  102. /**
  103. * Returns the annotation alias name.
  104. *
  105. * @return string
  106. *
  107. * @see ConfigurationInterface
  108. */
  109. public function getAliasName()
  110. {
  111. return 'template';
  112. }
  113. /**
  114. * Only one template directive is allowed.
  115. *
  116. * @return bool
  117. *
  118. * @see ConfigurationInterface
  119. */
  120. public function allowArray()
  121. {
  122. return false;
  123. }
  124. public function setOwner(array $owner)
  125. {
  126. $this->owner = $owner;
  127. }
  128. /**
  129. * The controller (+action) this annotation is attached to.
  130. *
  131. * @return array
  132. */
  133. public function getOwner()
  134. {
  135. return $this->owner;
  136. }
  137. }