Answer the question
In order to leave comments, you need to log in
The parameter controller, which is an object, should be typehinted. Cook better to do?
protected function tryRunMethod($controller, $method)
{
try {
$controller->$method();
} catch (\Exception $e) {
$this->sandResponseCode(Response::HTTP_METHOD_NOT_ALLOWED);
throw new \Exception($e);
}
}
Answer the question
In order to leave comments, you need to log in
i would try that
protected function tryRunMethod(Object $controller, $method)
{
try {
$controller->$method();
} catch (\Exception $e) {
$this->sandResponseCode(Response::HTTP_METHOD_NOT_ALLOWED);
throw new \Exception($e);
}
}
protected function tryRunMethod(ControllerClass $controller, $method)
{
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question