php获取方法或函数中的所有已定义变量

In php, how to get all variables defined in a method or function. There is the get_defined_vars() function, which gives variables of the function where I am printing(dump). But I need a function which takes a method name as argument and returns all variables in it.

Example: giveMeAllVariablesDefinedInside($class, $method) or something like this.

get_defined_vars

This function returns a multidimensional array containing a list of all defined variables, be them environment, server or user-defined variables, within the scope that get_defined_vars() is called.