refactoring routing and comments.

This commit is contained in:
Taylor Otwell
2011-10-15 14:04:11 -05:00
parent a44ca9d53b
commit a6eaa06981
20 changed files with 368 additions and 265 deletions

View File

@@ -59,25 +59,18 @@ abstract class Controller {
$response = call_user_func_array(array($controller, $method), $parameters);
}
$filters = array_merge($controller->filters('after'), array('after'));
// 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;
}
/**
* Determine if a given controller method is callable.
*
* @param string $method
* @return bool
*/
protected static function hidden($method)
{
return $method == 'before' or $method == 'after' or strncmp($method, '_', 1) == 0;
}
/**
* Resolve a controller name to a controller instance.
*
@@ -123,6 +116,17 @@ abstract class Controller {
return false;
}
/**
* Determine if a given controller method is callable.
*
* @param string $method
* @return bool
*/
protected static function hidden($method)
{
return $method == 'before' or $method == 'after' or strncmp($method, '_', 1) == 0;
}
/**
* Get an array of filter names defined for the destination.
*