@@ -25,13 +25,18 @@ class HookDocsGenerator
2525 */
2626 protected const SEARCH_INDEX_PATH = 'build/api/js/searchIndex.js ' ;
2727
28- protected static $ current_file = '' ;
29- protected static $ files_to_scan = [];
30- protected static $ pattern_custom_actions = ' /do_action(.*?);/i ' ;
31- protected static $ pattern_custom_filters = ' /apply_filters(.*?);/i ' ;
32- protected static $ found_files = [];
33- protected static $ custom_hooks_found = '' ;
28+ /**
29+ * List of files found.
30+ *
31+ * @var array
32+ */
33+ protected static $ found_files = [] ;
3434
35+ /**
36+ * Get files to scan.
37+ *
38+ * @return array
39+ */
3540 protected static function getFilesToScan (): array
3641 {
3742 $ files = [];
@@ -80,9 +85,16 @@ protected static function getFileLink(array $file): string
8085 return '<a href="../files/ ' . self ::getFileURL ($ file ) . '"> ' . basename ($ file ['path ' ]) . '</a> ' ;
8186 }
8287
88+ /**
89+ * Get files.
90+ *
91+ * @param string $pattern Search pattern.
92+ * @param int $flags Glob flags.
93+ * @param string $path Directory path.
94+ * @return array
95+ */
8396 protected static function getFiles ($ pattern , $ flags = 0 , $ path = '' )
8497 {
85-
8698 if (! $ path && ( $ dir = dirname ($ pattern ) ) != '. ' ) {
8799 if ('\\' == $ dir || '/ ' == $ dir ) {
88100 $ dir = '' ;
@@ -114,6 +126,12 @@ protected static function getFiles($pattern, $flags = 0, $path = '')
114126 return $ files ;
115127 }
116128
129+ /**
130+ * Get hooks.
131+ *
132+ * @param array $files_to_scan Files to scan.
133+ * @return array
134+ */
117135 protected static function getHooks (array $ files_to_scan ): array
118136 {
119137 $ scanned = [];
@@ -294,7 +312,10 @@ protected static function getJSOutput(array $hook_list): string
294312 return $ output ;
295313 }
296314
297- public static function processHooks ()
315+ /**
316+ * Apply changes to build/.
317+ */
318+ public static function applyChanges ()
298319 {
299320 $ files_to_scan = self ::getFilesToScan ();
300321 $ hook_list = self ::getHooks ($ files_to_scan );
@@ -323,4 +344,4 @@ public static function processHooks()
323344 }
324345}
325346
326- HookDocsGenerator::processHooks ();
347+ HookDocsGenerator::applyChanges ();
0 commit comments