Re: Generic decorators and type hinting
| From: | Ben Dunlap | Date: | Wed, 02 Sep 2009 22:50:06 +0000 |
| Subject: | Re: Generic decorators and type hinting | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297615@lists.php.net to get a copy of this message | ||
> 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 large, already-built code base that relies on Zend Framework
(which itself has 1600 classes), and wrap arbitrary existing methods
with timing logic -- without significant code changes.
As I understand your solution, it would require all pre-existing
classes to be modified to implement the iDecorator interface -- and
even then, pre-existing methods in those pre-existing classes would
not actually be affected. So those would have to be modified also.
But maybe I'm totally missing something?
Ben