Extracting function declarations from a PHP file
        Posted  
        
            by byronh
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by byronh
        
        
        
        Published on 2010-04-20T05:01:40Z
        Indexed on 
            2010/04/20
            5:13 UTC
        
        
        Read the original article
        Hit count: 310
        
I'm looking to create an on-site API reference for my framework and application.
Basically, say I have a class file model.class.php:
class Model extends Object {
    ... code here ...
    // Separates results into pages.
    // Returns Paginator object.
    final public function paginate($perpage = 10) {
        ... more code here ...
    }
}
and I want to be able to generate a reference that my developers can refer to quickly in order to know which functions are available to be called. They only need to see the comments directly above each function and the declaration line. Something like this (similar to a C++ header file):
// Separates results into pages.
// Returns Paginator object.
final public function paginate($perpage = 10);
I've done some research and this answer looked pretty good (using Reflection classes), however, I'm not sure how I can keep the comments in.
Any ideas?
EDIT: Sorry, but I want to keep the current comment formatting. Myself and the people who are working on the code hate the verbosity associated with PHPDocumentor. Not to mention a comment-rewrite of the entire project would take years, so I want to preserve just the // comments in plaintext.
© Stack Overflow or respective owner