ReflectionClass::getMethods
Gets an array of methods
&reftitle.description;
public arrayReflectionClass::getMethods
intfilter
Gets an array of methods for the class.
&reftitle.parameters;
filter
Filter the results to include only methods with certain attributes. Defaults
to no filtering.
Any combination of ReflectionMethod::IS_STATIC,
ReflectionMethod::IS_PUBLIC,
ReflectionMethod::IS_PROTECTED,
ReflectionMethod::IS_PRIVATE,
ReflectionMethod::IS_ABSTRACT,
ReflectionMethod::IS_FINAL.
&reftitle.returnvalues;
An array of ReflectionMethod objects
reflecting each method.
&reftitle.examples;
Basic usage of ReflectionClass::getMethods
getMethods();
var_dump($methods);
?>
]]>
&example.outputs;
&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"
}
}
]]>
Filtering results from ReflectionClass::getMethods
getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_FINAL);
var_dump($methods);
?>
]]>
&example.outputs;
&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"
}
}
]]>
&reftitle.seealso;
ReflectionClass::getMethod