note 76884 deleted from reflectionclass.getmethods by vrana
| From: | vrana@php.net | Date: | Fri, 13 Nov 2009 20:48:25 +0000 |
| Subject: | note 76884 deleted from reflectionclass.getmethods by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162883@lists.php.net to get a copy of this message | ||
Note Submitter: Will Mason
----
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();
?>