Index

JSDocumentor

MMO\doc · 1 symbol · generated 30 Sep 2026

class

JSDocumentor

JSDocumentor.php:36

Generates the javascript documentation of a package, exactly the way Documentor generates its php one.

class MMO\doc\JSDocumentor extends MMO\core\classes\aModule
Namespace
MMO\doc
Extends
aModule
See
Parser the javascript parser, JHSParser the .jhs custom element parser
Same model, same output, same navigation: one `.md` page plus its `.doc.json` model per file, and one `index.json` search index per language folder -- so a javascript symbol is searchable, linkable and renderable through the very same controllers as a php one. The only real difference is where the information comes from: there is no reflection for javascript, so the sources are read straight out. ### Where pages land Under `<the package's documentation folder>/js`, and which path inside it depends on the source: | source | mode | page | |---|---|---| | `src/js/core/functions/strings.js` declaring `MMO.core.strings` | namespace | `js/core/strings.md` | | `src/js/core/Map.js` declaring `MMO.core.Map` | namespace | `js/core/Map.md` | | `src/customElements/inputs/mmo-radio.jhs` | path | `js/elements/inputs/mmo-radio.md` | In namespace mode the root namespace (`MMO`) maps to the root folder, exactly as php's root namespace maps to `docs/php` -- so the tree reads the same in both languages.
\MMO\doc\JSDocumentor::Shared()->generate('mmo.client');

Index

folders
output
rootNamespace
sources
buildIndex($pages, $targets, $root)Write the index.json the search box reads (SearchController), in the same shape Documentor::buildIndex writes for php.
buildTargets($pages, $manifest)Map every documented symbol name onto where it can be linked: the markdown file (for relative links between pages) and the browsable page path, which the html renderer turns into a url at render time.
DefaultConfig() static
generate($libraries)Generate the javascript documentation of one or several installed packages.
generateLibrary($manifest)
getOutputFolder($manifest)
namespaceModePath($symbol)In namespace mode the page is the symbol's namespace turned into a path, with the root namespace mapped onto the root folder -- MMO.core.Map becomes core/Map, MMO.core.strings.bytesize become…
pageFor($pages, $symbol, $root, $source, $manifest)Find (or create) the page a symbol belongs on.
pagePath($manifest, $page)
parseFile($filename)
pathModePath($source)In path mode the page mirrors the source tree: inputs/mmo-radio.jhs under a prefix of elements becomes elements/inputs/mmo-radio.
resolveReference($reference, $targets)
resolveSymbol($symbol, $targets)Fill in every reference of a symbol -- its parent, the types of its members, parameters and returns -- with where that name is documented, now that every page is known.
resolveType($type, $targets)
resolveTypes($node, $targets)
sourceFiles($manifest)
stripRoot($name)

Properties4

folders

array $folders = []
Type
array

output

string $output = 'js'
Type
string

rootNamespace

string $rootNamespace = 'MMO'
Type
string

sources

array $sources = []
Type
array

Methods17

buildTargets($pages, $manifest)

JSDocumentor.php:258

Map every documented symbol name onto where it can be linked: the markdown file (for relative links between pages) and the browsable page path, which the html renderer turns into a url at render time.

protected function buildTargets(array $pages, object $manifest): array
See
Documentor::getPagePath why a url is never baked in here
$pagesarray
$manifestobject
returnsarraystring, anchor: string, page: string, short: string}>

generate($libraries)

JSDocumentor.php:73

Generate the javascript documentation of one or several installed packages.

function generate(string ...$libraries): void
...$librariesstring
returnsvoid

generateLibrary($manifest)

JSDocumentor.php:89
function generateLibrary(object $manifest): array
$manifestobject
returnsarraythe pages written, keyed by their markdown filename (empty when the package ships no javascript at all)

getOutputFolder($manifest)

JSDocumentor.php:172
function getOutputFolder(object $manifest): string
$manifestobject
returnsstringthe absolute folder the package's javascript pages are written into.

namespaceModePath($symbol)

JSDocumentor.php:231

In namespace mode the page is the symbol's namespace turned into a path, with the root namespace mapped onto the root folder -- MMO.core.Map becomes core/Map, MMO.core.strings.bytesize becomes core/strings, and anything sitting directly in the root namespace lands on index.

protected function namespaceModePath(MMO\doc\models\DocSymbol $symbol): string
$symbolDocSymbol
returnsstring

pageFor($pages, $symbol, $root, $source, $manifest)

JSDocumentor.php:193

Find (or create) the page a symbol belongs on.

protected function pageFor( array &$pages, MMO\doc\models\DocSymbol $symbol, string $root, array $source, object $manifest ): MMO\doc\models\DocPage
$pagesarray
$symbolDocSymbol
$rootstringthe package's javascript output folder
$sourcearraythe sources entry the file was found through
$manifestobject
returnsDocPage

parseFile($filename)

JSDocumentor.php:135
function parseFile(string $filename): array
$filenamestring
returnsarraywhatever the right parser reads out of that file

pathModePath($source)

JSDocumentor.php:217

In path mode the page mirrors the source tree: inputs/mmo-radio.jhs under a prefix of elements becomes elements/inputs/mmo-radio.

protected function pathModePath(array $source): string
$sourcearray
returnsstring

resolveReference($reference, $targets)

JSDocumentor.php:357
protected function resolveReference(array $reference, array $targets): array
$referencearray
$targetsarray
returnsarraythe reference, pointing at wherever that name is documented.

resolveSymbol($symbol, $targets)

JSDocumentor.php:299

Fill in every reference of a symbol -- its parent, the types of its members, parameters and returns -- with where that name is documented, now that every page is known.

protected function resolveSymbol(MMO\doc\models\DocSymbol $symbol, array $targets): void
$symbolDocSymbol
$targetsarray
returnsvoid

resolveType($type, $targets)

JSDocumentor.php:344
protected function resolveType(?array $type, array $targets): ?array
$typenull | array
$targetsarray
returnsnull | arraythe type, with every atom that names a documented symbol linked to it.

resolveTypes($node, $targets)

JSDocumentor.php:319
protected function resolveTypes(MMO\doc\models\DocNode $node, array $targets): void
$nodeDocNodea symbol or a member
$targetsarray
returnsvoid

sourceFiles($manifest)

JSDocumentor.php:153
function sourceFiles(object $manifest): array
$manifestobject
returnsarraystring, 1: array}> every javascript/jhs source of the package, with the sources entry it was found through
Inherited members (47)
ConstantsDeclared byDescription
ALERTiLogLevelAlert: Action must be taken immediately.
ALLiLogLevelMask for all
ALL_PLUSiLogLeveldebug everything
BACKTRACEiLogLevel
CRITICALiLogLevelCritical: Critical conditions.
DEBUGiLogLevelDebug: Detailed debug information.
DEEPiLogLeveldebug everything with arguments
EMERGENCYiLogLevelEmergency: System is unusable.
ERRORiLogLevelError: Runtime errors that do not require immediate action but should typically be logged and monitored.
ERROR_PLUSiLogLevelMask for all error
FATALiLogLevelMask for all fatal error
INFOiLogLevelInfo: Interesting events.
INFO_PLUSiLogLevelMask for all errors/warning/notices/info
MEMORYiLogLevelinclude backtrace object
NOTICEiLogLevelNotice: Normal but significant events.
NOTICE_PLUSiLogLevelMask for all errors/warning/notices/info
TRACEiLogLevelinclude backtrace as origins
WARNINGiLogLevelWarning: Exceptional occurrences that are not errors.
WARNING_PLUSiLogLevelMask for all errors and warnings
PropertiesDeclared byDescription
verbosityaModule
MethodsDeclared byDescription
alert($message, $context)aModuleAction must be taken immediately.
backtraces($message, $context)aModuleForce-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it).
Configure($config)aModuleMerge $config into this module's configuration in the shared Configuration.
critical($message, $context)aModuleCritical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.
debug($message, $context)aModuleDetailed debug information.
debugName()aModuleHuman-readable identifier used as the default {origin} in this instance's log messages.
emergency($message, $context)aModuleSystem is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.
error($message, $context)aModuleRuntime errors that do not require immediate action but should typically be logged and monitored.
getVerbosity()aModule
info($message, $context)aModuleInteresting events. No-op if INFO is currently filtered out by the verbosity mask.
Instantiate($config)aModule(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
IsShared()aModule
log($level, $message, $context)aModuleLogs with an arbitrary level.
notice($message, $context)aModuleNormal but significant events.
offsetExists($key)aModule\ArrayAccess::offsetExists -- tells whether $key is a declared property at all, regardless of whether it is currently readable/writable through array access.
offsetGet($key)aModule\ArrayAccess::offsetGet -- reads a property directly, unless it has a #[Serialize(serialize: 'methodName')] attribute, in which case that zero-argument method is called instead (e.g.
offsetSet($key, $value)aModule\ArrayAccess::offsetSet -- sets a property directly, unless it has a #[Serialize(unserialize: 'methodName')] attribute, in which case that method is called with $value instead (e.g.
offsetUnset($key)aModule\ArrayAccess::offsetUnset -- equivalent to $module[$key] = null.
serialize($path, $serializer)aModule\MMO\core\interfaces\iSerializable::serialize -- exports every property (via
setVerbosity($verb)aModuleSet the current verbosity mask, replacing whatever it was before.
Shared()aModuleGet the shared instance, creating (and configuring) it on first call.
testVerbosity($level)aModuleTest whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.
traitUnshare($serialize)aModuleRemove the shared instance, so the next Shared() call creates a fresh one.
unserialize($data, $path, $instances)aModule\MMO\core\interfaces\iSerializable::unserialize -- merges $data onto DefaultConfig, runs it through the (possibly overridden) constructor, then applies each resulting value to its property (via
Unshare($serialize)aModuleLike tSingleton::Unshare, but also disconnects this module's instance from every event it was listening to (via Event::DisconnectListeners) before dropping it.
warning($message, $context)aModuleExceptional occurrences that are not errors.
__construct($config)aModuleprotected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data.