1 | <?php |
||
38 | abstract class TwigController extends Controller |
||
39 | { |
||
40 | /** |
||
41 | * twig environment object, pulled from registry->twig |
||
42 | */ |
||
43 | private $twig; |
||
44 | |||
45 | /** |
||
46 | * assoc array containing all vars to use in template |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $_context = array(); |
||
51 | |||
52 | /** |
||
53 | * @var LoggerInterface |
||
54 | */ |
||
55 | protected $log; |
||
56 | |||
57 | /** |
||
58 | * @var ResponseFactoryInterface |
||
59 | */ |
||
60 | protected $responseFactory; |
||
61 | |||
62 | /** |
||
63 | * public contructor, call this from all derived classes |
||
64 | * |
||
65 | * @param TwigInterface $twig |
||
66 | * @param LoggerInterface $log |
||
67 | * @param ResponseFactoryInterface $responseFactory |
||
68 | */ |
||
69 | public function __construct( |
||
78 | |||
79 | /** |
||
80 | * @return LoggerInterface |
||
81 | */ |
||
82 | protected function getLogger() |
||
86 | |||
87 | /** |
||
88 | * render template with context, will merge context with allready known |
||
89 | * context |
||
90 | * |
||
91 | * @param string $template |
||
92 | * @param array $context |
||
93 | * @return string |
||
94 | */ |
||
95 | protected function render($template, $context = []) |
||
101 | |||
102 | /** |
||
103 | * @param string $template |
||
104 | * @param array $context |
||
105 | * @return ResponseInterface |
||
106 | */ |
||
107 | protected function renderResponse(string $template, array $context = []) : ResponseInterface |
||
114 | } |
||
115 |