downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ReflectionClass::getModifiers> <ReflectionClass::getMethod
Last updated: Fri, 20 Nov 2009

view this page in

ReflectionClass::getMethods

(PHP 5)

ReflectionClass::getMethodsGets 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.

See Also



add a note add a note User Contributed Notes
ReflectionClass::getMethods
phil dot bowles at btopenworld dot com
05-Sep-2009 05:02
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...
Will Mason
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();
?>

ReflectionClass::getModifiers> <ReflectionClass::getMethod
Last updated: Fri, 20 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites