Skip to content

Commit

Permalink
Remove additional is_callable checks.
Browse files Browse the repository at this point in the history
People overriding isAction() will have to do it correctly.
  • Loading branch information
markstory committed Oct 5, 2014
1 parent a88a85f commit 4dc98d4
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/Controller/Controller.php
Expand Up @@ -30,7 +30,7 @@
use Cake\Utility\MergeVariablesTrait;
use Cake\View\ViewVarsTrait;
use LogicException;
use ReflectionClass;
use ReflectionMethod;
use ReflectionException;

/**
Expand Down Expand Up @@ -410,14 +410,6 @@ public function invokeAction() {
));
}
$callable = [$this, $request->params['action']];
if (!is_callable($callable)) {
throw new MissingActionException(array(
'controller' => $this->name . "Controller",
'action' => $request->params['action'],
'prefix' => isset($request->params['prefix']) ? $request->params['prefix'] : '',
'plugin' => $request->params['plugin'],
));
}
return call_user_func_array($callable, $request->params['pass']);
}

Expand Down Expand Up @@ -663,12 +655,11 @@ public function paginate($object = null) {
* and allows all public methods on all subclasses of this class.
*
* @param string $action The action to check.
* @return boolean Whether or not the method is accesible from a URL.
* @return bool Whether or not the method is accesible from a URL.
*/
public function isAction($action) {
$reflection = new ReflectionClass($this);
try {
$method = $reflection->getMethod($action);
$method = new ReflectionMethod($this, $action);
} catch (\ReflectionException $e) {
return false;
}
Expand Down

0 comments on commit 4dc98d4

Please sign in to comment.