Skip to content

Commit

Permalink
exception namespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFricker committed Feb 12, 2017
1 parent 8678998 commit 6a75bba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
namespace DavidFricker\Router;

use DavidFricker\Router\Capsule\RouteContainer;
use DavidFricker\Router\Exception\InvalidRouteException;
use DavidFricker\Router\Exception\InvalidControllerException;

/**
* A wrapper around a DB driver to expose a uniform interface
Expand Down Expand Up @@ -37,7 +39,7 @@ public function dispatch($resource_route, $request) {
// route the request to the correct controller
$target = explode('@', $route->getTarget());
if (count($target) != 2) {
throw new InvalidArgumentException('The target of the Route object must be a lambda function or a string defined as method@namespace\\class');
throw new \InvalidArgumentException('The target of the Route object must be a lambda function or a string defined as method@namespace\\class');
}

$method_name = $target[0];
Expand All @@ -54,7 +56,7 @@ public function dispatch($resource_route, $request) {
// ensure the method corresponding to the action exists, allowing a graceful fail otherwise
if (!method_exists($controller, $method_name)) {
// SPL Exception
throw new BadFunctionCallException('Controller method not found');
throw new \BadFunctionCallException('Controller method not found');
}

// call method on controller object
Expand Down

0 comments on commit 6a75bba

Please sign in to comment.