1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-25 20:44:01 +01:00

[ticket/13502] Controller resolver should handle callable functions and objects

PHPBB3-13502
This commit is contained in:
RFD 2015-01-13 15:12:25 -05:00 committed by Marc Alexander
parent f9b6086302
commit ada90d3b0a

View File

@ -126,9 +126,18 @@ class resolver implements ControllerResolverInterface
*/
public function getArguments(Request $request, $controller)
{
// At this point, $controller contains the object and method name
list($object, $method) = $controller;
$mirror = new \ReflectionMethod($object, $method);
// At this point, $controller should be a callable
if (is_array($controller))
{
list($object, $method) = $controller;
$mirror = new \ReflectionMethod($object, $method);
} else if (is_object($controller) && !$controller instanceof \Closure)
{
$mirror = new \ReflectionObject($controller);
$mirror = $mirror->getMethod('__invoke');
} else {
$mirror = new \ReflectionFunction($controller);
}
$arguments = array();
$parameters = $mirror->getParameters();