Cake\Controller\Controller::isAction PHP Method

isAction() public method

Override this method to change which controller methods can be reached. The default implementation disallows access to all methods defined on Cake\Controller\Controller, and allows all public methods on all subclasses of this class.
public isAction ( string $action ) : boolean
$action string The action to check.
return boolean Whether or not the method is accessible from a URL.
    public function isAction($action)
    {
        $baseClass = new ReflectionClass('Cake\\Controller\\Controller');
        if ($baseClass->hasMethod($action)) {
            return false;
        }
        try {
            $method = new ReflectionMethod($this, $action);
        } catch (ReflectionException $e) {
            return false;
        }
        return $method->isPublic();
    }

Usage Example

Example #1
-1
 /**
  * {@inheritdoc}
  *
  * @param string $action
  * @return bool
  */
 public function isAction($action)
 {
     if ($action == 'construct') {
         return false;
     }
     return parent::isAction($action);
 }