|
Posted by Wayne on 02/16/06 20:48
On Thu, 16 Feb 2006 09:33:49 +0200, "Ryan White" <ryan@trigger.co.za>
wrote:
>Things work fantastically under php4, but I know that when I swap over to
>php5, it's going to throw a hissy fit, because reassigning $this is not
>allowed.
>
>Aside from going around the Message class, and just starting messages of a
>particular type from scratch:
>
>Is there some sort of cunning retro-fit I could do to the Message class, so
>I don't have to trawl through thousands of lines of code?
Use a factory method. Declare a public static method in the messaging
class that creates the appropriate type:
class Messge {
public static function factory($msgType) {
... return the correct type here ...
}
}
Then just do a search & replace of all your 'new Message(' code and
replace it with 'Message::factory('...
Navigation:
[Reply to this message]
|