1 | <?php |
||
8 | class BaseComponent implements Component |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $template; |
||
14 | /** |
||
15 | * @var Request |
||
16 | */ |
||
17 | protected $request; |
||
18 | /** |
||
19 | * @var Storage |
||
20 | */ |
||
21 | protected $storage; |
||
22 | /** |
||
23 | * @var mixed |
||
24 | */ |
||
25 | protected $renderedContent; |
||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $parameters = array(); |
||
30 | /*** |
||
31 | * @var \stdClass |
||
32 | */ |
||
33 | protected $matchedSitemapItem; |
||
34 | |||
35 | /** |
||
36 | * BaseComponent constructor. |
||
37 | * |
||
38 | * @param string $template |
||
39 | * @param Request $request |
||
40 | * @param array $parameters |
||
41 | * @param $matchedSitemapItem |
||
42 | */ |
||
43 | public function __construct($template='', Request $request, $parameters=array(), $matchedSitemapItem) |
||
50 | |||
51 | /** |
||
52 | * Hook for implementation in derived classes |
||
53 | * |
||
54 | * @param Storage $storage |
||
55 | * @return mixed|void |
||
56 | */ |
||
57 | public function run(Storage $storage) |
||
61 | |||
62 | /** |
||
63 | * Renders the template |
||
64 | * |
||
65 | * @throws \Exception |
||
66 | */ |
||
67 | public function render() |
||
71 | |||
72 | /** |
||
73 | * Returns the rendered content |
||
74 | * |
||
75 | * @return mixed |
||
76 | */ |
||
77 | public function get() |
||
81 | |||
82 | /** |
||
83 | * Decoupled render method, for usage in derived classes |
||
84 | * |
||
85 | * @param string $template |
||
86 | * |
||
87 | * @return string |
||
88 | * @throws \Exception |
||
89 | */ |
||
90 | public function renderTemplate($template='', $obClean = true) |
||
105 | |||
106 | /** |
||
107 | * Alias for renderTemplate for usage to include templates in other templates |
||
108 | * |
||
109 | * @param string $template |
||
110 | * |
||
111 | * @param array $parameters |
||
112 | * |
||
113 | * @return string |
||
114 | * @throws \Exception |
||
115 | */ |
||
116 | public function includeTemplate($template='', $parameters = array()) |
||
125 | } |
||
126 | } |