some small refactorings and cleanup.
This commit is contained in:
@@ -101,34 +101,38 @@ class Route {
|
||||
// a controller, the controller will only call its own filters.
|
||||
$before = array_merge(array('before'), $this->filters('before'));
|
||||
|
||||
if ( ! is_null($response = Filter::run($before, array(), true)))
|
||||
{
|
||||
return $response;
|
||||
}
|
||||
$response = Filter::run($before, array(), true);
|
||||
|
||||
if ( ! is_null($response = $this->response()))
|
||||
if (is_null($response) and ! is_null($response = $this->response()))
|
||||
{
|
||||
if ($response instanceof Delegate)
|
||||
{
|
||||
$response = Controller::call($response->destination, $this->parameters);
|
||||
}
|
||||
|
||||
// The after filter and the framework expects all responses to
|
||||
// be instances of the Response class. If the route did not
|
||||
// return an instsance of Response, we will make on now.
|
||||
if ( ! $response instanceof Response)
|
||||
{
|
||||
$response = new Response($response);
|
||||
}
|
||||
|
||||
$filters = array_merge($this->filters('after'), array('after'));
|
||||
|
||||
Filter::run($filters, array($response));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
return Response::error('404');
|
||||
// If we still don't have a response, we're out of options and
|
||||
// will use the 404 response. We will still let the response
|
||||
// hit the after filter in case the developer is doing any
|
||||
// logging or other work where every response is needed.
|
||||
if (is_null($response))
|
||||
{
|
||||
$response = Response::error('404');
|
||||
}
|
||||
|
||||
// The after filter and the framework expects all responses to
|
||||
// be instances of the Response class. If the route did not
|
||||
// return an instsance of Response, we will make on now.
|
||||
if ( ! $response instanceof Response)
|
||||
{
|
||||
$response = new Response($response);
|
||||
}
|
||||
|
||||
$filters = array_merge($this->filters('after'), array('after'));
|
||||
|
||||
Filter::run($filters, array($response));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user