bavragor / function-documentor
函数用法文档生成器
v1.0.0
2018-07-09 11:02 UTC
Requires
- php: >=5.6
- ext-tokenizer: *
- nikic/php-parser: 3.1.*
- psr/log: ^1.0
Provides
- psr/log-implementation: 1.0.0
This package is auto-updated.
Last update: 2024-09-04 20:09:09 UTC
README
通过提供的外部导出器生成指定函数用法的格式化文档
当前将被检测到的函数调用
- ${variable}->${property}->${class}->${function}
- ${class}::${function}
当前导出
- TableExport: 尚未实现
- ArrayExport: 提供一个包含检测到的函数调用及其参数的数组
示例(ArrayExport,无格式化器)
代码
<?php require_once __DIR__ . '/vendor/autoload.php'; $functionDocumentor = new \Bavragor\FunctionDocumentor\FunctionDocumentor( new \Bavragor\FunctionDocumentor\Export\ArrayExport(), 'directoryToSourceCode' ); $functions = $functionDocumentor->retrieve([ 'isys_settings' => [ 'get' ], 'isys_tenantsettings' => [ 'get' ], 'settingsSystem' => [ 'get' ] ], ['src/tests'], true); var_export($functions);
将生成类似这样的输出
array ( 'isys_settings::get' => array ( 0 => array ( 0 => '$p_key', 1 => '$p_default', ), ), 'isys_tenantsettings::get' => array ( 0 => array ( 0 => 'system.devmode', ), 1 => array ( 0 => '$p_key', 1 => '$p_default', ), ), 'settingsSystem->get' => array ( 0 => array ( 0 => 'system.timezone', 1 => 'Europe/Berlin', ), 1 => array ( 0 => 'ldap.debug', 1 => 'true', ), 2 => array ( 0 => 'system.dir.file-upload', 1 => '$this->app_path/upload/files/$this->app_path/upload/files/', ), 3 => array ( 0 => 'system.dir.image-upload', 1 => '$this->app_path/upload/images/$this->app_path/upload/images/', ), ), )%