Re: [PHP] Generic decorators and type hinting

2009-09-02 Thread Ben Dunlap
Is there another way to cleanly wrap method calls for timing/logging purposes? I have a possibly-evil idea that gets around type-hinting by dynamically declaring decorator classes as children of the real classes that need to be timed. You end up with as many decorators as you have classes that

Re: [PHP] Generic decorators and type hinting

2009-09-02 Thread David Kurtz
On Sep 2, 2009, at 12:17 PM, Ben Dunlap wrote: I've got some sample code written that first calls get_class_methods() to list the names of all the visible methods of the parent object, then constructs code to declare a child class that overrides those methods with wrapper methods, and finally

Re: [PHP] Generic decorators and type hinting

2009-09-02 Thread Christoph Boget
I have a possibly-evil idea that gets around type-hinting by dynamically declaring decorator classes as children of the real classes that need to be timed. You end up with as many decorators as you have classes that need to be timed, but if this is for dev/QA purposes only, that might not be

Re: [PHP] Generic decorators and type hinting

2009-09-02 Thread Ben Dunlap
code.  Instead, just use interfaces.  The only real downside is that all the classes you want to decorate would need to implement them and that would cause a wee bit of ugliness in the code/class declaration. Can you explain a bit more? As I understood the OP, the challenge was to take a