note 76884 modified in language.oop5.reflection by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Sep 2009 16:16:26 +0000 |
| Subject: | note 76884 modified in language.oop5.reflection by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160718@lists.php.net to get a copy of this message | ||
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();
?>
--was--
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();
?>
http://php.net/manual/en/language.oop5.reflection.php