The CommandFactory Class

An instance of the CommandFactory class is provided for the Controller class by the ApplicationResources object in Listing 24.1 on line 19. The Controller could instantiate its own CommandFactory, but by delegating object creation to the ApplicationResources object, we provide it the opportunity to configure the CommandFactory for us.

You can see the CommandFactory class in Listing 24.4.

Listing 24.4. The CommandFactory Class
 1: <? 2: // command/CommandFactory.php 3: // qframe license: http://resources.corrosive.co.uk/pkg/qframe/license.txt 4: 5: require_once 'controller/ApplicationResources.php'; 6: 7: 8: abstract class CommandFactory { 9: abstract function setDefaultCommand ( $str ); 10: abstract function getDefaultCommand ...

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.