July 9, 2006
Decorators in PHP5
Until now I thought that decorating an object variable or method isn’t possible with PHP5, because __set, __get and __call, if you use them directly, are only working if you set or get variables (or call methods) that have not yet been defined.
But Ivo Jansch describes a nifty workaround by creating a forward class that overrides the built-in __set, __get and __call methods. This forward class can then be used to extend your decorator classes, allowing you to decorate variables and methods of your classes even if they have already been defined. Read the complete post here: Building proxies, decorators and delegates in PHP5.
Filed by Manuel Kiessling at 11:33 am under technology, software, open source, php
Write a comment
Trackback