MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

DocGenerator

MMO\client · 1 symbole · générée le 27 Oct 2026

class

DocGenerator

DocGenerator.php:15

Generates the complete HTML documentation from a JSON file

class MMO\client\DocGenerator
Espace de noms
MMO\client
How to use : $generator = new DocGenerator(); $jsonFile = '/doc_example.json'; $html = $generator->generate($jsonFile); unlink($jsonFile); echo $html;

Index

allowedTags
generate($jsonFile)Generates the complete HTML documentation from a JSON file
renderCodeBlock($section)Renders a code block
renderCustomElement($section)Renders the documentation of a Custom Element
renderDemo($section)Generates a demo
renderParagraph($section)If the paragraph is ordered, render an ordered list If the paragraph is a heading, render a heading Otherwise, render a paragraph with inline HTML allowed
renderSection($section, $opts)Renders a section according to its type
sanitizeInlineHtml($content)Sanitizes inline HTML
t($message)Translate a heading of the generated documentation (shown in the hub, in the application's language).

Propriétés1

allowedTags

array $allowedTags = ['code', 'pre', 'strong', 'em', 'a', 'span', 'br']
Type
array

Méthodes8

generate($jsonFile)

DocGenerator.php:23

Generates the complete HTML documentation from a JSON file

function generate(string $jsonFile): string
$jsonFilestring: path to the JSON file
retournestring

renderCodeBlock($section)

DocGenerator.php:111

Renders a code block

protected function renderCodeBlock(array $section): string
$sectionarray: accepts the following keys: - code string : code to display - title string : title of the code block
retournestring

renderCustomElement($section)

DocGenerator.php:131

Renders the documentation of a Custom Element

protected function renderCustomElement(array $section): string
$sectionarray: accepts the following keys: - tag string : tag of the custom element - description string : description of the custom element - css array : CSS classes to display - attributes array : attributes of the custom element - methods array : methods of the custom element - content array : content of the custom element
retournestring

renderDemo($section)

DocGenerator.php:242

Generates a demo

protected function renderDemo(array $section): string
$sectionarray: accepts the following keys: - horizontal boolean : if true, the demo is horizontal - example string : HTML code of the demo
retournestring

renderParagraph($section)

DocGenerator.php:77

If the paragraph is ordered, render an ordered list If the paragraph is a heading, render a heading Otherwise, render a paragraph with inline HTML allowed

protected function renderParagraph(array $section): string
$sectionarray: accepts the following keys: - content string : content of the paragraph - ordered boolean : if true, the paragraph is an ordered list - headingLevel integer : if defined, the paragraph is a heading - classes string : CSS classes to apply to the paragraph
retournestring

renderSection($section, $opts)

DocGenerator.php:53

Renders a section according to its type

protected function renderSection(array $section, array $opts = []): string
$sectionarray: accepts the following keys: - type string : type of the section - demo array : demo of the section - code-block array : code block of the section - custom-element array : custom element of the section - paragraph array : paragraph of the section
$opts = []array
retournestring

sanitizeInlineHtml($content)

DocGenerator.php:264

Sanitizes inline HTML

protected function sanitizeInlineHtml(string $content): string
$contentstring: content to sanitize
retournestring

t($message)

DocGenerator.php:254

Translate a heading of the generated documentation (shown in the hub, in the application's language).

protected function t(string $message): string
$messagestringthe English text
retournestringhtml-escaped