ReflectionClass::getMethods
Obtém um array de métodos
&reftitle.description;
public arrayReflectionClass::getMethods
intnullfilter&null;
Obtém um array de métodos para a classe.
&reftitle.parameters;
filter
Filtre os resultados para incluir apenas métodos com determinados atributos. Padrões
sem filtragem.
Qualquer disjunção bit a bit de ReflectionMethod::IS_STATIC,
ReflectionMethod::IS_PUBLIC,
ReflectionMethod::IS_PROTECTED,
ReflectionMethod::IS_PRIVATE,
ReflectionMethod::IS_ABSTRACT,
ReflectionMethod::IS_FINAL,
para que todos os métodos com qualquer dos dados
atributos serão retornados.
Observe que outras operações bit a bit, por exemplo ~
não funcionará como esperado. Em outras palavras, não é possível
recuperar todos os métodos não estáticos, por exemplo.
&reftitle.returnvalues;
Um array de objetos ReflectionMethod
refletindo cada método.
&reftitle.changelog;
&Version;
&Description;
7.2.0
filter agora é anulável.
&reftitle.examples;
Uso básico de 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"
}
}
]]>
Filtrando resultados vindos de 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
get_class_methods