ReflectionClass::getMethods
Pobiera tablicę metod
&reftitle.description;
public arrayReflectionClass::getMethods
intnullfilter&null;
Pobiera tablicę metod klasy.
&reftitle.parameters;
filter
Filtruje wyniki tak, aby zawierały tylko metody z określonymi atrybutami. Domyślnie
brak filtrowania.
Dowolna kombinacja bitowa stałych ReflectionMethod::IS_STATIC,
ReflectionMethod::IS_PUBLIC,
ReflectionMethod::IS_PROTECTED,
ReflectionMethod::IS_PRIVATE,
ReflectionMethod::IS_ABSTRACT,
ReflectionMethod::IS_FINAL,
aby zwrócić metody pasujące do któregokolwiek z
podanych atrybutów.
Zauważ że inne operatory bitowe, na przykład ~,
nie będą działały jak oczekiwane. Innymi słowy nie jest możliwe
np. pobranie wszystkich metod niestatycznych.
&reftitle.returnvalues;
Tablica obiektów ReflectionMethod
reprezentujących każdą z metod.
&reftitle.changelog;
&Version;
&Description;
7.2.0
Parametr filter dopuszcza teraz &null;.
&reftitle.examples;
Podstawowe użycie ReflectionClass::getMethods
getMethods();
var_dump($methods);
?>
]]>
&example.outputs;
object(ReflectionMethod)#2 (2) {
["name"]=>
string(11) "pierwszaMetoda"
["class"]=>
string(5) "Jablko"
}
[1]=>
object(ReflectionMethod)#3 (2) {
["name"]=>
string(12) "drugaMetoda"
["class"]=>
string(5) "Jablko"
}
[2]=>
object(ReflectionMethod)#4 (2) {
["name"]=>
string(11) "trzeciaMetoda"
["class"]=>
string(5) "Jablko"
}
}
]]>
Filtrowanie wyników ReflectionClass::getMethods
getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_FINAL);
var_dump($methods);
?>
]]>
&example.outputs;
object(ReflectionMethod)#2 (2) {
["name"]=>
string(12) "drugaMetoda"
["class"]=>
string(5) "Jablko"
}
[1]=>
object(ReflectionMethod)#3 (2) {
["name"]=>
string(11) "trzeciaMetoda"
["class"]=>
string(5) "Jablko"
}
}
]]>
&reftitle.seealso;
ReflectionClass::getMethod
get_class_methods