Cake\Controller\Controller::isAction PHP Метод

isAction() публичный Метод

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.
Результат 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

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