Make specifying the path to the handler script optional in Route since it is not needed if using an autoloader.

This commit is contained in:
PJ Dietz 2013-01-10 21:21:57 -05:00
parent 331bdae7ec
commit 3ff2371edd
2 changed files with 3 additions and 2 deletions

View File

@ -47,7 +47,7 @@ class Route {
* @param $handler
* @param $handlerPath
*/
public function __construct($pattern, $handler, $handlerPath) {
public function __construct($pattern, $handler, $handlerPath=null) {
$this->pattern = $pattern;
$this->handler = $handler;

View File

@ -53,7 +53,8 @@ class Router {
$klass = $route->handler;
if (!class_exists($klass)) {
// Autoload, if needed.
if (!class_exists($klass) && is_string($route->handlerPath)) {
require_once($route->handlerPath);
}