Skip to content

Commit

Permalink
Merge pull request #2 from Levdbas/patch-1
Browse files Browse the repository at this point in the history
Run Reflection() class on functions generator
  • Loading branch information
gchtr authored Apr 26, 2024
2 parents a5af150 + 117884e commit 7809772
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/Console/FunctionReferenceGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 7809772

Please sign in to comment.