Conditions | 103 |
Paths | > 20000 |
Total Lines | 434 |
Code Lines | 316 |
Lines | 77 |
Ratio | 17.74 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
11 | function makeHTML($indent, $parent, $expandAll, $hereid = '') |
||
|
|||
12 | { |
||
13 | $modx = evolutionCMS(); |
||
14 | global $icons, $_style, $_lang, $opened, $opened2, $closed2, $modx_textdir; |
||
15 | |||
16 | $output = ''; |
||
17 | |||
18 | // setup spacer |
||
19 | $level = 0; |
||
20 | $spacer = '<span class="indent">'; |
||
21 | for ($i = 2; $i <= $indent; $i++) { |
||
22 | $spacer .= '<i></i>'; |
||
23 | $level++; |
||
24 | } |
||
25 | $spacer .= '</span>'; |
||
26 | |||
27 | // manage order-by |
||
28 | if (!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { |
||
29 | // This is the first startup, set default sort order |
||
30 | $_SESSION['tree_sortby'] = 'menuindex'; |
||
31 | $_SESSION['tree_sortdir'] = 'ASC'; |
||
32 | } |
||
33 | |||
34 | switch ($_SESSION['tree_sortby']) { |
||
35 | case 'createdon': |
||
36 | case 'editedon': |
||
37 | case 'publishedon': |
||
38 | case 'pub_date': |
||
39 | case 'unpub_date': |
||
40 | $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], |
||
41 | 'sc.' . $_SESSION['tree_sortby']); |
||
42 | break; |
||
43 | default: |
||
44 | $sortby = 'sc.' . $_SESSION['tree_sortby']; |
||
45 | }; |
||
46 | |||
47 | $orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
||
48 | |||
49 | // Folder sorting gets special setup ;) Add menuindex and pagetitle |
||
50 | if ($_SESSION['tree_sortby'] == 'isfolder') { |
||
51 | $orderby .= ', menuindex ASC, pagetitle'; |
||
52 | } |
||
53 | |||
54 | $tblsc = $modx->getFullTableName('site_content'); |
||
55 | $tbldg = $modx->getFullTableName('document_groups'); |
||
56 | $tblst = $modx->getFullTableName('site_templates'); |
||
57 | // get document groups for current user |
||
58 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', |
||
59 | $_SESSION['mgrDocgroups']) : ''; |
||
60 | $showProtected = false; |
||
61 | if (isset ($modx->config['tree_show_protected'])) { |
||
62 | $showProtected = (boolean)$modx->config['tree_show_protected']; |
||
63 | } |
||
64 | $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0'; |
||
65 | if ($showProtected == false) { |
||
66 | $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
||
67 | } else { |
||
68 | $access = ''; |
||
69 | } |
||
70 | $docgrp_cond = $docgrp ? "OR dg.document_group IN ({$docgrp})" : ''; |
||
71 | $field = "DISTINCT sc.id, pagetitle, longtitle, menutitle, parent, isfolder, published, pub_date, unpub_date, richtext, searchable, cacheable, deleted, type, template, templatename, menuindex, donthit, hidemenu, alias, contentType, privateweb, privatemgr, |
||
72 | MAX(IF(1={$mgrRole} OR sc.privatemgr=0 {$docgrp_cond}, 1, 0)) AS hasAccess, GROUP_CONCAT(document_group SEPARATOR ',') AS roles"; |
||
73 | $from = "{$tblsc} AS sc LEFT JOIN {$tbldg} dg on dg.document = sc.id LEFT JOIN {$tblst} st on st.id = sc.template"; |
||
74 | $where = "(parent={$parent}) {$access} GROUP BY sc.id"; |
||
75 | $result = $modx->db->select($field, $from, $where, $orderby); |
||
76 | if ($modx->db->getRecordCount($result) == 0) { |
||
77 | $output .= sprintf('<div><a class="empty">%s%s <span class="empty">%s</span></a></div>', $spacer, |
||
78 | $_style['tree_deletedpage'], $_lang['empty_folder']); |
||
79 | } |
||
80 | |||
81 | $nodeNameSource = $_SESSION['tree_nodename'] == 'default' ? $modx->config['resource_tree_node_name'] : $_SESSION['tree_nodename']; |
||
82 | |||
83 | while ($row = $modx->db->getRow($result)) { |
||
84 | $node = ''; |
||
85 | $nodetitle = getNodeTitle($nodeNameSource, $row); |
||
86 | $nodetitleDisplay = $nodetitle; |
||
87 | $treeNodeClass = 'node'; |
||
88 | $treeNodeClass .= $row['hasAccess'] == 0 ? ' protected' : ''; |
||
89 | |||
90 | if ($row['deleted'] == 1) { |
||
91 | $treeNodeClass .= ' deleted'; |
||
92 | } elseif ($row['published'] == 0) { |
||
93 | $treeNodeClass .= ' unpublished'; |
||
94 | } elseif ($row['hidemenu'] == 1) { |
||
95 | $treeNodeClass .= ' hidemenu'; |
||
96 | } |
||
97 | |||
98 | if ($row['id'] == $hereid) { |
||
99 | $treeNodeClass .= ' current'; |
||
100 | } |
||
101 | |||
102 | $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
||
103 | $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
||
104 | |||
105 | // Prepare displaying user-locks |
||
106 | $lockedByUser = ''; |
||
107 | $rowLock = $modx->elementIsLocked(7, $row['id'], true); |
||
108 | if ($rowLock && $modx->hasPermission('display_locks')) { |
||
109 | if ($rowLock['sid'] == $modx->sid) { |
||
110 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
||
111 | 'element_type' => $_lang["lock_element_type_7"], |
||
112 | 'lasthit_df' => $rowLock['lasthit_df'] |
||
113 | )); |
||
114 | $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
||
115 | } else { |
||
116 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
||
117 | 'element_type' => $_lang["lock_element_type_7"], |
||
118 | 'username' => $rowLock['username'], |
||
119 | 'lasthit_df' => $rowLock['lasthit_df'] |
||
120 | )); |
||
121 | View Code Duplication | if ($modx->hasPermission('remove_locks')) { |
|
122 | $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
||
123 | } else { |
||
124 | $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
||
125 | } |
||
126 | } |
||
127 | } |
||
128 | |||
129 | $url = $modx->makeUrl($row['id']); |
||
130 | |||
131 | $title = ''; |
||
132 | if (isDateNode($nodeNameSource)) { |
||
133 | $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
||
134 | } |
||
135 | $title .= $_lang['id'] . ': ' . $row['id']; |
||
136 | $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
||
137 | $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
||
138 | $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
||
139 | $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
||
140 | $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
||
141 | $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
||
142 | $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
||
143 | $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
||
144 | $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
||
145 | $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
||
146 | $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
||
147 | $title = $modx->htmlspecialchars($title); |
||
148 | $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
||
149 | |||
150 | $data = array( |
||
151 | 'id' => $row['id'], |
||
152 | 'pagetitle' => $row['pagetitle'], |
||
153 | 'longtitle' => $row['longtitle'], |
||
154 | 'menutitle' => $row['menutitle'], |
||
155 | 'parent' => $parent, |
||
156 | 'isfolder' => $row['isfolder'], |
||
157 | 'published' => $row['published'], |
||
158 | 'deleted' => $row['deleted'], |
||
159 | 'type' => $row['type'], |
||
160 | 'menuindex' => $row['menuindex'], |
||
161 | 'donthit' => $row['donthit'], |
||
162 | 'hidemenu' => $row['hidemenu'], |
||
163 | 'alias' => $row['alias'], |
||
164 | 'contenttype' => $row['contentType'], |
||
165 | 'privateweb' => $row['privateweb'], |
||
166 | 'privatemgr' => $row['privatemgr'], |
||
167 | 'hasAccess' => $row['hasAccess'], |
||
168 | 'template' => $row['template'], |
||
169 | 'nodetitle' => $nodetitle, |
||
170 | 'url' => $url, |
||
171 | 'title' => $title, |
||
172 | 'nodetitleDisplay' => $nodetitleDisplay, |
||
173 | 'weblinkDisplay' => $weblinkDisplay, |
||
174 | 'pageIdDisplay' => $pageIdDisplay, |
||
175 | 'lockedByUser' => $lockedByUser, |
||
176 | 'treeNodeClass' => $treeNodeClass, |
||
177 | 'treeNodeSelected' => $row['id'] == $hereid ? ' treeNodeSelected' : '', |
||
178 | 'tree_page_click' => $modx->config['tree_page_click'], |
||
179 | 'showChildren' => 1, |
||
180 | 'openFolder' => 1, |
||
181 | 'contextmenu' => '', |
||
182 | 'tree_minusnode' => $_style['tree_minusnode'], |
||
183 | 'tree_plusnode' => $_style['tree_plusnode'], |
||
184 | 'spacer' => $spacer, |
||
185 | 'subMenuState' => '', |
||
186 | 'level' => $level, |
||
187 | 'isPrivate' => 0, |
||
188 | 'roles' => ($row['roles'] ? $row['roles'] : '') |
||
189 | ); |
||
190 | |||
191 | $ph = $data; |
||
192 | $ph['nodetitle_esc'] = addslashes($nodetitle); |
||
193 | $ph['indent'] = $indent + 1; |
||
194 | $ph['expandAll'] = $expandAll; |
||
195 | $ph['isPrivate'] = ($row['privateweb'] || $row['privatemgr']) ? 1 : 0; |
||
196 | |||
197 | if (!$row['isfolder']) { |
||
198 | $tpl = getTplSingleNode(); |
||
199 | switch ($row['id']) { |
||
200 | case $modx->config['site_start'] : |
||
201 | $icon = $_style['tree_page_home']; |
||
202 | break; |
||
203 | case $modx->config['error_page'] : |
||
204 | $icon = $_style['tree_page_404']; |
||
205 | break; |
||
206 | case $modx->config['site_unavailable_page'] : |
||
207 | $icon = $_style['tree_page_hourglass']; |
||
208 | break; |
||
209 | case $modx->config['unauthorized_page'] : |
||
210 | $icon = $_style['tree_page_info']; |
||
211 | break; |
||
212 | default: |
||
213 | View Code Duplication | if (isset($icons[$row['contentType']])) { |
|
214 | $icon = $icons[$row['contentType']]; |
||
215 | } else { |
||
216 | $icon = $_style['tree_page']; |
||
217 | } |
||
218 | } |
||
219 | $ph['icon'] = $icon; |
||
220 | |||
221 | // invoke OnManagerNodePrerender event |
||
222 | $prenode = $modx->invokeEvent("OnManagerNodePrerender", array('ph' => $ph)); |
||
223 | View Code Duplication | if (is_array($prenode)) { |
|
224 | $phnew = array(); |
||
225 | foreach ($prenode as $pnode) { |
||
226 | $phnew = array_merge($phnew, unserialize($pnode)); |
||
227 | } |
||
228 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
||
229 | } |
||
230 | |||
231 | View Code Duplication | if ($ph['contextmenu']) { |
|
232 | $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
||
233 | } |
||
234 | |||
235 | if ($_SESSION['tree_show_only_folders']) { |
||
236 | if ($row['parent'] == 0) { |
||
237 | $node .= $modx->parseText($tpl, $ph); |
||
238 | } else { |
||
239 | $node .= ''; |
||
240 | } |
||
241 | } else { |
||
242 | $node .= $modx->parseText($tpl, $ph); |
||
243 | } |
||
244 | |||
245 | } else { |
||
246 | $ph['icon_folder_open'] = $_style['tree_folderopen_new']; |
||
247 | $ph['icon_folder_close'] = $_style['tree_folder_new']; |
||
248 | |||
249 | if ($_SESSION['tree_show_only_folders']) { |
||
250 | $tpl = getTplFolderNodeNotChildren(); |
||
251 | $checkFolders = checkIsFolder($row['id'], 1) ? 1 : 0; // folders |
||
252 | $checkDocs = checkIsFolder($row['id'], 0) ? 1 : 0; // no folders |
||
253 | $ph['tree_page_click'] = 3; |
||
254 | |||
255 | // expandAll: two type for partial expansion |
||
256 | if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
||
257 | if ($expandAll == 1) { |
||
258 | $opened2[] = $row['id']; |
||
259 | } |
||
260 | $ph['icon'] = $ph['icon_folder_open']; |
||
261 | $ph['icon_node_toggle'] = $ph['tree_minusnode']; |
||
262 | $ph['node_toggle'] = 1; |
||
263 | $ph['subMenuState'] = ' open'; |
||
264 | |||
265 | if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
||
266 | $ph['showChildren'] = 1; |
||
267 | $ph['icon_node_toggle'] = ''; |
||
268 | $ph['icon'] = $ph['icon_folder_close']; |
||
269 | } elseif (!$checkDocs && $checkFolders) { |
||
270 | $ph['showChildren'] = 0; |
||
271 | $ph['openFolder'] = 2; |
||
272 | } else { |
||
273 | $ph['openFolder'] = 2; |
||
274 | } |
||
275 | |||
276 | // invoke OnManagerNodePrerender event |
||
277 | $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
||
278 | 'ph' => $ph, |
||
279 | 'opened' => '1' |
||
280 | )); |
||
281 | View Code Duplication | if (is_array($prenode)) { |
|
282 | $phnew = array(); |
||
283 | foreach ($prenode as $pnode) { |
||
284 | $phnew = array_merge($phnew, unserialize($pnode)); |
||
285 | } |
||
286 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
||
287 | } |
||
288 | |||
289 | View Code Duplication | if ($ph['contextmenu']) { |
|
290 | $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
||
291 | } |
||
292 | |||
293 | $node .= $modx->parseText($tpl, $ph); |
||
294 | if ($checkFolders) { |
||
295 | $node .= makeHTML($indent + 1, $row['id'], $expandAll, $hereid); |
||
296 | } |
||
297 | $node .= '</div></div>'; |
||
298 | } else { |
||
299 | $closed2[] = $row['id']; |
||
300 | $ph['icon'] = $ph['icon_folder_close']; |
||
301 | $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
||
302 | $ph['node_toggle'] = 0; |
||
303 | |||
304 | if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
||
305 | $ph['showChildren'] = 1; |
||
306 | $ph['icon_node_toggle'] = ''; |
||
307 | } elseif (!$checkDocs && $checkFolders) { |
||
308 | $ph['showChildren'] = 0; |
||
309 | $ph['openFolder'] = 2; |
||
310 | } else { |
||
311 | $ph['openFolder'] = 2; |
||
312 | } |
||
313 | |||
314 | // invoke OnManagerNodePrerender event |
||
315 | $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
||
316 | 'ph' => $ph, |
||
317 | 'opened' => '0' |
||
318 | )); |
||
319 | View Code Duplication | if (is_array($prenode)) { |
|
320 | $phnew = array(); |
||
321 | foreach ($prenode as $pnode) { |
||
322 | $phnew = array_merge($phnew, unserialize($pnode)); |
||
323 | } |
||
324 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
||
325 | } |
||
326 | |||
327 | View Code Duplication | if ($ph['contextmenu']) { |
|
328 | $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
||
329 | } |
||
330 | |||
331 | $node .= $modx->parseText($tpl, $ph); |
||
332 | $node .= '</div></div>'; |
||
333 | } |
||
334 | } else { |
||
335 | $tpl = getTplFolderNode(); |
||
336 | // expandAll: two type for partial expansion |
||
337 | if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
||
338 | if ($expandAll == 1) { |
||
339 | $opened2[] = $row['id']; |
||
340 | } |
||
341 | $ph['icon'] = $ph['icon_folder_open']; |
||
342 | $ph['icon_node_toggle'] = $ph['tree_minusnode']; |
||
343 | $ph['node_toggle'] = 1; |
||
344 | $ph['subMenuState'] = ' open'; |
||
345 | |||
346 | View Code Duplication | if ($ph['donthit'] == 1) { |
|
347 | $ph['tree_page_click'] = 3; |
||
348 | $ph['icon_node_toggle'] = ''; |
||
349 | $ph['icon'] = $ph['icon_folder_close']; |
||
350 | $ph['showChildren'] = 0; |
||
351 | } |
||
352 | |||
353 | // invoke OnManagerNodePrerender event |
||
354 | $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
||
355 | 'ph' => $ph, |
||
356 | 'opened' => '1' |
||
357 | )); |
||
358 | if (is_array($prenode)) { |
||
359 | $phnew = array(); |
||
360 | foreach ($prenode as $pnode) { |
||
361 | $phnew = array_merge($phnew, unserialize($pnode)); |
||
362 | } |
||
363 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
||
364 | if ($ph['showChildren'] == 0) { |
||
365 | unset($opened2[$row['id']]); |
||
366 | $ph['node_toggle'] = 0; |
||
367 | $ph['subMenuState'] = ''; |
||
368 | } |
||
369 | } |
||
370 | |||
371 | View Code Duplication | if ($ph['showChildren'] == 0) { |
|
372 | $ph['icon_node_toggle'] = ''; |
||
373 | $ph['donthit'] = 1; |
||
374 | $ph['icon'] = $ph['icon_folder_close']; |
||
375 | $tpl = getTplFolderNodeNotChildren(); |
||
376 | } |
||
377 | |||
378 | View Code Duplication | if ($ph['contextmenu']) { |
|
379 | $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
||
380 | } |
||
381 | |||
382 | $node .= $modx->parseText($tpl, $ph); |
||
383 | if ($ph['donthit'] == 0) { |
||
384 | $node .= makeHTML($indent + 1, $row['id'], $expandAll, $hereid); |
||
385 | } |
||
386 | $node .= '</div></div>'; |
||
387 | } else { |
||
388 | $closed2[] = $row['id']; |
||
389 | $ph['icon'] = $ph['icon_folder_close']; |
||
390 | $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
||
391 | $ph['node_toggle'] = 0; |
||
392 | |||
393 | View Code Duplication | if ($ph['donthit'] == 1) { |
|
394 | $ph['tree_page_click'] = 3; |
||
395 | $ph['icon_node_toggle'] = ''; |
||
396 | $ph['icon'] = $ph['icon_folder_close']; |
||
397 | $ph['showChildren'] = 0; |
||
398 | } |
||
399 | |||
400 | // invoke OnManagerNodePrerender event |
||
401 | $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
||
402 | 'ph' => $ph, |
||
403 | 'opened' => '0' |
||
404 | )); |
||
405 | View Code Duplication | if (is_array($prenode)) { |
|
406 | $phnew = array(); |
||
407 | foreach ($prenode as $pnode) { |
||
408 | $phnew = array_merge($phnew, unserialize($pnode)); |
||
409 | } |
||
410 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
||
411 | } |
||
412 | |||
413 | View Code Duplication | if ($ph['showChildren'] == 0) { |
|
414 | $ph['icon_node_toggle'] = ''; |
||
415 | $ph['donthit'] = 1; |
||
416 | $ph['icon'] = $ph['icon_folder_close']; |
||
417 | $tpl = getTplFolderNodeNotChildren(); |
||
418 | } |
||
419 | |||
420 | View Code Duplication | if ($ph['contextmenu']) { |
|
421 | $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
||
422 | } |
||
423 | |||
424 | $node .= $modx->parseText($tpl, $ph); |
||
425 | $node .= '</div></div>'; |
||
426 | } |
||
427 | } |
||
428 | } |
||
429 | |||
430 | // invoke OnManagerNodeRender event |
||
431 | $data['node'] = $node; |
||
432 | $evtOut = $modx->invokeEvent('OnManagerNodeRender', $data); |
||
433 | if (is_array($evtOut)) { |
||
434 | $evtOut = implode("\n", $evtOut); |
||
435 | } |
||
436 | if ($evtOut != '') { |
||
437 | $node = trim($evtOut); |
||
438 | } |
||
439 | |||
440 | $output .= $node; |
||
441 | } |
||
442 | |||
443 | return $output; |
||
444 | } |
||
445 | } |
||
694 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: