TemplateRenderer.php 1013 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /*
  3. * This file is part of the php-phantomjs.
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. */
  8. namespace JonnyW\PhantomJs\Template;
  9. /**
  10. * PHP PhantomJs
  11. *
  12. * @author Jon Wenmoth <contact@jonnyw.me>
  13. */
  14. class TemplateRenderer implements TemplateRendererInterface
  15. {
  16. /**
  17. * Twig environment instance.
  18. *
  19. * @var \Twig_Environment
  20. * @access protected
  21. */
  22. protected $twig;
  23. /**
  24. * Internal constructor.
  25. *
  26. * @access public
  27. * @param \Twig_Environment $twig
  28. */
  29. public function __construct(\Twig_Environment $twig)
  30. {
  31. $this->twig = $twig;
  32. }
  33. /**
  34. * Render template.
  35. *
  36. * @access public
  37. * @param string $template
  38. * @param array $context (default: array())
  39. * @return string
  40. */
  41. public function render($template, array $context = array())
  42. {
  43. return $this->twig->render($template, $context);
  44. }
  45. }