Right now classes are indexed using some mildly hacky regular expressions. It would be a big improvement to use token_get_all() and parse the token stream for class, interface, global function definitions and build the index that way. This would also allow for dependencies to be mapped as well. By looking for extends or implements a full dependency graph could be constructed.
This would have two main benefits. It would allow for ApiGenerator to work on non-cake apps more effectively. Currently its kind of a kludge to get it to work on non-cake apps. It would also allow for neat things like visual graphs to be created with tools like graphviz or canvas.
The indexing process could look something like.
Get a list of files to scan.
Iterate the list of files and do the following.
Scan for class, interface and global functions. Store these in a list of files -> objects
Get the extends and implements for any classes. Store these in parent -> children arrays.
Create a tree of class dependencies.
Traverse the tree and persist values to the database.
Having a more complete index, would also make doing things like creating a word index of the doc blocks / methods easier.
Created by Mark Story, 11th Dec 2010. (originally Lighthouse ticket #34):
Right now classes are indexed using some mildly hacky regular expressions. It would be a big improvement to use
token_get_all()
and parse the token stream for class, interface, global function definitions and build the index that way. This would also allow for dependencies to be mapped as well. By looking forextends
orimplements
a full dependency graph could be constructed.This would have two main benefits. It would allow for ApiGenerator to work on non-cake apps more effectively. Currently its kind of a kludge to get it to work on non-cake apps. It would also allow for neat things like visual graphs to be created with tools like graphviz or canvas.
The indexing process could look something like.