private function validate($class, $func, $args) { // handle if $class not exist or $class doesnt have $func or number of $args not equals if (!class_exists($class) || !method_exists(new $class(), $func) || count((new \ReflectionMethod($class, $func))->getParameters()) != count($args)) { return $this->notFoundException(); } // check permissions $rules = (new $class())->rules(); if (isset($rules['accessControl']) && AccessControl::validate($rules['accessControl']) == false) { return $this->forbiddenException(); } return true; }