1 | <?php |
||
9 | class BaseComponent implements Component |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $template; |
||
15 | /** |
||
16 | * @var Request |
||
17 | */ |
||
18 | protected $request; |
||
19 | /** |
||
20 | * @var Storage |
||
21 | */ |
||
22 | protected $storage; |
||
23 | /** |
||
24 | * @var mixed |
||
25 | */ |
||
26 | protected $renderedContent; |
||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $parameters = array(); |
||
31 | /*** |
||
32 | * @var \stdClass |
||
33 | */ |
||
34 | protected $matchedSitemapItem; |
||
35 | |||
36 | /** |
||
37 | * BaseComponent constructor. |
||
38 | * |
||
39 | * @param string $template |
||
40 | * @param Request $request |
||
41 | * @param array $parameters |
||
42 | * @param $matchedSitemapItem |
||
43 | */ |
||
44 | public function __construct($template='', Request $request, $parameters=array(), $matchedSitemapItem) |
||
51 | |||
52 | /** |
||
53 | * Hook for implementation in derived classes |
||
54 | * |
||
55 | * @param Storage $storage |
||
56 | * @return mixed|void |
||
57 | */ |
||
58 | public function run(Storage $storage) |
||
62 | |||
63 | /** |
||
64 | * Renders the template |
||
65 | * |
||
66 | * @param null|Application $application |
||
67 | * |
||
68 | * @throws \Exception |
||
69 | */ |
||
70 | public function render($application=null) |
||
74 | |||
75 | /** |
||
76 | * Returns the rendered content |
||
77 | * |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function get() |
||
84 | |||
85 | /** |
||
86 | * Decoupled render method, for usage in derived classes |
||
87 | * |
||
88 | * @param string $template |
||
89 | * |
||
90 | * @param bool $obClean |
||
91 | * @param null|Application $application |
||
92 | * |
||
93 | * @return string |
||
94 | * @throws \Exception |
||
95 | */ |
||
96 | public function renderTemplate($template='', $obClean = true, $application=null) |
||
119 | |||
120 | /** |
||
121 | * Alias for renderTemplate for usage to include templates in other templates |
||
122 | * |
||
123 | * @param string $template |
||
124 | * |
||
125 | * @param array $parameters |
||
126 | * |
||
127 | * @return string |
||
128 | * @throws \Exception |
||
129 | */ |
||
130 | public function includeTemplate($template='', $parameters = array()) |
||
139 | |||
140 | public function getParameters() |
||
144 | } |
||
145 | } |