PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1

CHAPTER 9 ■ GENERATING OBJECTS


function getFooterText() {
return "BloggsCal footer\n";
}
}


Figure 9-8. Adding a concrete creator and some concrete products


Notice that I use the Factory Method pattern in this example. getContact() is abstract in
CommsManager and implemented in BloggsCommsManager. Design patterns tend to work together in this
way, one pattern creating the context that lends itself to another. In Figure 9-9, I add support for the
MegaCal format.

Free download pdf