From 117884e542385ee271309c7eb1c1671bc9172533 Mon Sep 17 00:00:00 2001 From: Erik van der Bas Date: Fri, 10 Nov 2023 13:09:14 +0100 Subject: [PATCH] Run Reflection() class on functions generator --- lib/Console/FunctionReferenceGenerator.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/Console/FunctionReferenceGenerator.php b/lib/Console/FunctionReferenceGenerator.php index 456bcb9..b6d3b44 100644 --- a/lib/Console/FunctionReferenceGenerator.php +++ b/lib/Console/FunctionReferenceGenerator.php @@ -11,6 +11,7 @@ use Teak\Compiler\Heading; use Teak\Compiler\Method\Method; use Teak\Compiler\Method\Table; +use Teak\Reflection\Reflection; /** * Console command used to extract markdown-formatted documentation from classes @@ -60,14 +61,25 @@ public function handleClassCollection($input, $output, $files) foreach ($project->getFiles() as $file) { $functions = $file->getFunctions(); + $functions_to_document = []; - if (empty($functions)) { + foreach ($functions as $function) { + $classReflection = new Reflection($function); + + if ($classReflection->shouldIgnore()) { + continue; + } + + $functions_to_document[] = $function; + } + + if (empty($functions_to_document)) { continue; } - $contents .= (new Table($functions))->compile(); + $contents .= (new Table($functions_to_document))->compile(); - foreach ($file->getFunctions() as $function) { + foreach ($functions_to_document as $function) { $classReference = new Method($function); $contents .= $classReference->compile();