views:

85

answers:

6

I'm trying to find automated way of finding where in the code a function is used.

Some form of autogenerated documentation where I have Class->method is used in this files: a.php , b.php etc. I am tryng to find something out there to prevent rolling my own. We currently have no automated documentation system so anything goes.

+4  A: 

Simplistic suggestion, but "grep -R methodName?"

EFraim
+2  A: 

Check out Doxygen or phpDocumentor.

MatW
A: 

Your favorite editor should have recursive regular expression search for files. That's a good place to start without all that fancy auto generated doc stuff.

Byron Whitlock
+1  A: 

http://php.net/manual/en/function.debug-backtrace.php

The function debug_backtrace() will show all the incoming calls to the particular function in stack trace format. It returns an array so you may want to print_r() it. Wrapping pre tags around it makes it a bit more readable if you don't know about them already.

So:

function your_function ()
{
echo "<pre>";
print_r (debug_backtrace ());
echo "</pre>";
}

should do what you need

Meep3D
A: 

Install Google Desktop on your computer.

rodey
A: 

Take a look at nWire for PHP. It is a code exploration plugin for Eclipse PDT and Zend Studio 7.x. Once you click on a method, you will get all the invocation within the code. It can even handle cases where the target invocation cannot be determined at design time by showing all possible implementations.

zvikico