Skip to content

Commit

Permalink
Fix Class doc generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
HorstOeko committed Nov 16, 2024
1 parent 08e56c1 commit 23fdc64
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions make/genmethoddocs.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,18 @@ public function generateMarkdown(): MarkDownGenerator
$this->addEmptyLine();
}

$this->addLineH4("Summary");

if (!empty($methodData["methodDetails"]["summary"])) {
$this->addLine($methodData["methodDetails"]["summary"])->addEmptyLine();
}

if (!empty($methodData["methodDetails"]["description"])) {
$this->addLine($methodData["methodDetails"]["description"])->addEmptyLine();
}

$this->addLineH4("Signature");

$phpMethod = $phpClass->addMethod($methodName);
$phpMethod->setPublic();
$phpMethod->setStatic($methodData["methodDetails"]["static"] === true);
Expand All @@ -293,15 +305,8 @@ public function generateMarkdown(): MarkDownGenerator
$this->addLineRaw($phpPrinter->printMethod($phpMethod));
$this->addLineRaw("```");

if (!empty($methodData["methodDetails"]["summary"])) {
$this->addLine($methodData["methodDetails"]["summary"])->addEmptyLine();
}

if (!empty($methodData["methodDetails"]["description"])) {
$this->addLine($methodData["methodDetails"]["description"])->addEmptyLine();
}

if (!empty($methodData["parameters"])) {
$this->addLineH4("Parameters");
$this->addLine("| Name | Type | Allows Null | Description");
$this->addLine("| :------ | :------ | :-----: | :------");

Expand Down Expand Up @@ -439,6 +444,24 @@ private function addLineH3(string $string, bool $newLine = true): MarkDownGenera
return $this;
}

/**
* Add an H4-Line to internal container
*
* @param string $string
* @param boolean $newLine
* @return MarkDownGenerator
*/
private function addLineH4(string $string, bool $newLine = true): MarkDownGenerator
{
$this->addLine("#### %s", $string);

if ($newLine) {
$this->addEmptyLine();
}

return $this;
}

/**
* Add a string to the latest line which was added
*
Expand Down

0 comments on commit 23fdc64

Please sign in to comment.