AclExtras::_checkMethods PHP Метод

_checkMethods() защищенный Метод

Check and Add/delete controller Methods
protected _checkMethods ( $className, $controllerName, array $node, $pluginPath = false ) : void
$node array
Результат void
    protected function _checkMethods($className, $controllerName, $node, $pluginPath = false)
    {
        $excludes = $this->_getCallbacks($className);
        $baseMethods = get_class_methods('Controller');
        $actions = get_class_methods($className);
        if ($actions == null) {
            $this->err(__('Unable to get methods for "%s"', $className));
            return false;
        }
        $methods = array_diff($actions, $baseMethods);
        $methods = array_diff($methods, $excludes);
        foreach ($methods as $action) {
            if (strpos($action, '_', 0) === 0) {
                continue;
            }
            $path = $this->rootNode . '/' . $pluginPath . $controllerName . '/' . $action;
            $this->_checkNode($path, $action, $node['Aco']['id']);
        }
        if ($this->_clean) {
            $actionNodes = $this->Aco->children($node['Aco']['id']);
            $methodFlip = array_flip($methods);
            foreach ($actionNodes as $action) {
                if (!isset($methodFlip[$action['Aco']['alias']])) {
                    $this->Aco->id = $action['Aco']['id'];
                    if ($this->Aco->delete()) {
                        $path = $this->rootNode . '/' . $controllerName . '/' . $action['Aco']['alias'];
                        $this->out(__('Deleted Aco node: <warning>%s</warning>', $path), 1, Shell::VERBOSE);
                    }
                }
            }
        }
        return true;
    }