1717
1818namespace Docs \Controllers ;
1919
20- use function array_search ;
2120use Phalcon \Cache \BackendInterface ;
2221use Phalcon \Config ;
2322use Phalcon \Mvc \Controller as PhController ;
2423use Phalcon \Mvc \View \Simple ;
24+ use function array_search ;
2525use function Docs \Functions \app_path ;
2626use function Docs \Functions \config ;
2727use function Docs \Functions \environment ;
2828use function file_exists ;
29- use function var_dump ;
3029
3130/**
3231 * Docs\Controllers\BaseController
@@ -70,7 +69,7 @@ public function getSidebar($language, $version): array
7069
7170 if (true === file_exists ($ pageName )) {
7271 $ data = file_get_contents ($ pageName );
73- } elseif (true === file_exists ($ apiFileName )) {
72+ } else if (true === file_exists ($ apiFileName )) {
7473 $ data = file_get_contents ($ apiFileName );
7574 } else {
7675 // The article does not exist
@@ -179,6 +178,25 @@ protected function getSeoTitle(string $language, string $version, string $page):
179178 return $ title ;
180179 }
181180
181+ /**
182+ * @param string $language
183+ * @param string $version
184+ * @param string $fileName
185+ *
186+ * @return string
187+ */
188+ protected function getMenu ($ language , $ version , $ fileName ): string
189+ {
190+ $ document = $ this ->getDocument ($ language , $ version , $ fileName );
191+ $ document = str_replace (
192+ '<li> ' ,
193+ '<li class="toc-entry toc-h2"> ' ,
194+ $ document
195+ );
196+
197+ return ltrim (rtrim ($ document , '</ul> ' ), '<ul> ' );
198+ }
199+
182200 /**
183201 * @param string $language
184202 * @param string $version
@@ -194,7 +212,7 @@ protected function getDocument($language, $version, $fileName): string
194212 return $ this ->cacheData ->get ($ key );
195213 }
196214
197- $ pageName = app_path (
215+ $ pageName = app_path (
198216 sprintf (
199217 'docs/%s/%s/%s.md ' ,
200218 $ version ,
@@ -229,25 +247,6 @@ protected function getDocument($language, $version, $fileName): string
229247 return $ data ;
230248 }
231249
232- /**
233- * @param string $language
234- * @param string $version
235- * @param string $fileName
236- *
237- * @return string
238- */
239- protected function getMenu ($ language , $ version , $ fileName ): string
240- {
241- $ document = $ this ->getDocument ($ language , $ version , $ fileName );
242- $ document = str_replace (
243- '<li> ' ,
244- '<li class="toc-entry toc-h2"> ' ,
245- $ document
246- );
247-
248- return ltrim (rtrim ($ document , '</ul> ' ), '<ul> ' );
249- }
250-
251250 /**
252251 * Returns the current version string with its prefix if applicable
253252 *
0 commit comments