-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
looking to list classes with their methods and properties #5
Comments
Hi Andrew! Yes, you need to create your own plugin (say, MyPlugin.class.php) and load it via config file: ## xref.ini
[xref]
plugins-dir = /path/to/dir/with/your/plugin
[doc]
plugins[] = MyPlugin If you're overriding this setting, you may also need to include all default doc plugins The plugin itself may look something like: <?php
class MyPlugin extends XRef_APlugin implements XRef_IDocumentationPlugin {
public function __construct() {
parent::__construct('my-id', "list of classes with their methods");
}
// process each source file
public function generateFileReport(XRef_IParsedFile $pf) {
foreach ($pf->getClasses() as $classObj) {
foreach ($classObj->methods as $methodObj) {
echo $classObj->name . "::" . $methodObj->name;
// TODO: save classes/methods names
}
}
}
// generate total report
public function generateTotalReport() {
list($fh, $root) = $this->xref->getOutputFileHandle($this->reportId, null);
fwrite($fh,
$this->xref->fillTemplate(
'<your-template-name-here>.tmpl',
array(
'reportName' => $this->getName(),
'reportId' => $this->getId(),
'root' => $root,
// TODO: use saved classes/method names as template params
)
)
);
fclose($fh);
}
} I haven't tested it yet and oh, you'll need to a template file to produce html output. Good luck and thanks, |
thanks for the quick reply and the sample code... I think I see what is going on more now. One thing I was thinking was in order to get an actual list of all methods of a class, I would need to also retrieve methods of classes ,y class extends and list the ones not overridden by the extending class. I guess I will need to do some recursive logic with getclasses() to do that. |
Yes, inherited methods require more logic: array |
Hi, I was looking at xref to help me produce an output file of classes in a set of source files, which I can see plainly exists. However, I would also like to nest within those class reports the methods that belong to a specific class and properties of the class.
The current doc plugin group seems to not have a defined way of getting the methods/properties associated with a class. There seems to be a list of classes, a list of methods, and a list of properties, unless I am missing something.
Any idea how I would achieve this? Do I need to write my own plugin set for this?
Thanks... oh and I love this project.
The text was updated successfully, but these errors were encountered: