The undocumented filter parameter is pretty straightforward:
its one of:
const integer ReflectionMethod::IS_STATIC = 1 ;
const integer ReflectionMethod::IS_PUBLIC = 256 ;
const integer ReflectionMethod::IS_PROTECTED = 512 ;
const integer ReflectionMethod::IS_PRIVATE = 1024 ;
const integer ReflectionMethod::IS_ABSTRACT = 2 ;
const integer ReflectionMethod::IS_FINAL = 4 ;
and restrict the array returned to those methods matching the filter type...
ReflectionClass::getMethods
(PHP 5)
ReflectionClass::getMethods — Gets a list of methods
Description
public array ReflectionClass::getMethods
([ string $filter
] )
Gets a list of methods.
Warning
This function is currently not documented; only its argument list is available.
Parameters
- filter
-
Any combination of ReflectionMethod::IS_STATIC, ReflectionMethod::IS_PUBLIC, ReflectionMethod::IS_PROTECTED, ReflectionMethod::IS_PRIVATE, ReflectionMethod::IS_ABSTRACT, ReflectionMethod::IS_FINAL.
Return Values
An array of methods.
ReflectionClass::getMethods
phil dot bowles at btopenworld dot com
05-Sep-2009 05:02
05-Sep-2009 05:02
Will Mason
03-Aug-2007 10:29
03-Aug-2007 10:29
If you are looking for the long $filters for ReflectionClass::getMethods(), here they are. They took me a long time to find. Found nothing in the docs, nor google. But of course, Reflection itself was the final solution, in the form of ReflectionExtension::export("Reflection").
<?php
//The missing long $filter values!!!
ReflectionMethod::IS_STATIC;
ReflectionMethod::IS_PUBLIC;
ReflectionMethod::IS_PROTECTED;
ReflectionMethod::IS_PRIVATE;
ReflectionMethod::IS_ABSTRACT;
ReflectionMethod::IS_FINAL;
//Use them like this
$R = new ReflectionClass("MyClass");
//print all public methods
foreach ($R->getMethods(ReflectionMethod::IS_PUBLIC) as $m)
echo $m->__toString();
?>
