The Dispatcher Class

The Dispatcher class is provided to the Controller by the ApplicationResources object. We cover a particular implementation in this section, but we have used an abstract base class again to allow for more sophisticated solutions. The abstract Dispatcher class is shown in Listing 24.7.

Listing 24.7. The Dispatcher Class
 1: <?php 2: // controller/Dispatcher.php 3: // qframe license: http://resources.corrosive.co.uk/pkg/qframe/license.txt 4: 5: require_once 'controller/RequestHelper.php'; 6: 7: 8: abstract class Dispatcher { 9: private $views; 10: 11: function __construct( $view_dir ) { 12: $this->views = $view_dir; 13: } 14: 15: abstract function getNext( RequestHelper $helper ); 16: 17: function dispatch( RequestHelper ...

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.