1: <?php
2:
3: namespace PHPixie\Template;
4:
5: class Container
6: {
7: protected $renderer;
8: protected $template;
9: protected $data;
10:
11: public function __construct($renderer, $template, $data)
12: {
13: $this->renderer = $renderer;
14: $this->template = $template;
15: $this->data = $data;
16: }
17:
18: public function template()
19: {
20: return $this->template;
21: }
22:
23: public function data()
24: {
25: return $this->data;
26: }
27:
28: public function get($path, $default = null)
29: {
30: return $this->data->get($path, $default);
31: return $this;
32: }
33:
34: public function set($path, $data)
35: {
36: $this->data->set($path, $data);
37: return $this;
38: }
39:
40: public function remove($path)
41: {
42: $this->data->remove($path);
43: return $this;
44: }
45:
46: public function render()
47: {
48: return $this->renderer->render(
49: $this->template,
50: $this->data->get()
51: );
52: }
53:
54: public function __set($path, $data)
55: {
56: $this->set($path, $data);
57: }
58:
59: public function __get($path)
60: {
61: return $this->get($path);
62: }
63: }