1 | <?php |
||
8 | class BaseComponent implements Component |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $template; |
||
14 | /** |
||
15 | * @var \CloudControl\Cms\cc\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 | */ |
||
56 | public function run(Storage $storage) |
||
60 | |||
61 | /** |
||
62 | * Renders the template |
||
63 | * |
||
64 | * @param null|Application $application |
||
65 | * |
||
66 | * @throws \Exception |
||
67 | */ |
||
68 | public function render($application=null) |
||
72 | |||
73 | /** |
||
74 | * Returns the rendered content |
||
75 | * |
||
76 | * @return mixed |
||
77 | */ |
||
78 | public function get() |
||
82 | |||
83 | /** |
||
84 | * Decoupled render method, for usage in derived classes |
||
85 | * |
||
86 | * @param string $template |
||
87 | * |
||
88 | * @param bool $obClean |
||
89 | * @param null|Application $application |
||
90 | * |
||
91 | * @return string |
||
92 | * @throws \Exception |
||
93 | */ |
||
94 | public function renderTemplate($template='', $obClean = true, $application=null) |
||
117 | |||
118 | /** |
||
119 | * Alias for renderTemplate for usage to include templates in other templates |
||
120 | * |
||
121 | * @param string $template |
||
122 | * |
||
123 | * @param array $parameters |
||
124 | * |
||
125 | * @return string |
||
126 | * @throws \Exception |
||
127 | */ |
||
128 | public function includeTemplate($template='', $parameters = array()) |
||
137 | |||
138 | public function getParameters() |
||
142 | |||
143 | /** |
||
144 | * @param $template |
||
145 | * @param null $application |
||
146 | * @return string |
||
147 | */ |
||
148 | protected function getTemplatePath($template, $application=null) |
||
154 | } |
||
155 | } |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.