オブジェクトのメソッドを確認

オブジェクトに定義されているメソッド名が知りたい場合、直接定義されているファイルを覗いてもよいのですが、PHPでブラウザ表示する事もできます。

PHP5から採用されているReflectionを利用します。

例)symfonyのactionにて、controllerが持っているメソッド

$obj = new ReflectionObject($this->getController());
print_r($obj->getMethods());
Array ( 
[0] => ReflectionMethod Object ( [name] => dispatch 	[class] => sfFrontWebController ) 
[1] => ReflectionMethod Object ( [name] => genUrl [class] => sfFrontWebController ) 
[2] => ReflectionMethod Object ( [name] => convertUrlStringToParameters [class] => sfFrontWebController ) 
[3] => ReflectionMethod Object ( [name] => redirect [class] => sfFrontWebController ) 
[4] => ReflectionMethod Object ( [name] => __construct [class] => sfFrontWebController ) 
[5] => ReflectionMethod Object ( [name] => initialize [class] => sfFrontWebController ) 
[6] => ReflectionMethod Object ( [name] => componentExists [class] => sfFrontWebController ) 
[7] => ReflectionMethod Object ( [name] => actionExists [class] => sfFrontWebController ) 
[8] => ReflectionMethod Object ( [name] => controllerExists [class] => sfFrontWebController ) 
[9] => ReflectionMethod Object ( [name] => forward [class] => sfFrontWebController ) 
[10] => ReflectionMethod Object ( [name] => getAction [class] => sfFrontWebController ) 
[11] => ReflectionMethod Object ( [name] => getComponent [class] => sfFrontWebController ) 
[12] => ReflectionMethod Object ( [name] => getController [class] => sfFrontWebController ) 
[13] => ReflectionMethod Object ( [name] => getActionStack [class] => sfFrontWebController ) 
[14] => ReflectionMethod Object ( [name] => getRenderMode [class] => sfFrontWebController ) 
[15] => ReflectionMethod Object ( [name] => getView [class] => sfFrontWebController ) 
[16] => ReflectionMethod Object ( [name] => sendEmail [class] => sfFrontWebController ) 
[17] => ReflectionMethod Object ( [name] => getPresentationFor [class] => sfFrontWebController ) 
[18] => ReflectionMethod Object ( [name] => setRenderMode [class] => sfFrontWebController ) 
[19] => ReflectionMethod Object ( [name] => inCLI [class] => sfFrontWebController ) 
[20] => ReflectionMethod Object ( [name] => __call [class] => sfFrontWebController ) ) 

nameの値がメソッド名、ついでにclassでクラス名もわかります。
※処理内容まで知りたい時は直接ファイルを見るしかない



他にも色々あるので、詳細はPHPマニュアルにて
http://jp.php.net/manual/ja/class.reflection.php