|
ReflectionClass::getMethodsメソッドの配列を取得する 説明
public array ReflectionClass::getMethods(intnull
$filter = null )クラスのメソッドの配列を取得します。 パラメータ
戻り値各メソッドを表す ReflectionMethod オブジェクトの配列を返します。 変更履歴
例
例1 ReflectionClass::getMethods の基本的な使用例
<?php 上の例の出力は以下となります。 array(3) { [0]=> object(ReflectionMethod)#2 (2) { ["name"]=> string(11) "firstMethod" ["class"]=> string(5) "Apple" } [1]=> object(ReflectionMethod)#3 (2) { ["name"]=> string(12) "secondMethod" ["class"]=> string(5) "Apple" } [2]=> object(ReflectionMethod)#4 (2) { ["name"]=> string(11) "thirdMethod" ["class"]=> string(5) "Apple" } }
例2 ReflectionClass::getMethods のフィルタリング
<?php 上の例の出力は以下となります。 array(2) { [0]=> object(ReflectionMethod)#2 (2) { ["name"]=> string(12) "secondMethod" ["class"]=> string(5) "Apple" } [1]=> object(ReflectionMethod)#3 (2) { ["name"]=> string(11) "thirdMethod" ["class"]=> string(5) "Apple" } } 参考
|