Page 1 of 1

Doing some code generation... need to find out args

Posted: Fri Dec 23, 2005 10:29 pm
by Ambush Commander
Okay, here's what I need to do. I need to create a script that will analyze another class, and then generate a decorator for it. My first line of thought was to use get_class_methods() and then iterate over that array, but that would not tell me what the arguments are.

There doesn't seem to be a way to examine arguments of a class, so I was thinking to ways to go about it:

1. Actually lex the page, and then figure out the args from the tokens, or
2. Use call_user_func_array() and func_get_args in tandem. (unfortunantely, they seem to pass by value, not by reference, which could cause problems)

Am I overlooking a third technique? I really, really don't want to have to lex the page.