public function action(string $action) { if (empty($action)) { throw new \Exception('Empty action name!'); } if ($this->web->isRender()) { return $this; } $objectRef = $this->getReflection(); $args = $this->getActionArgs($this->web->params()); $methods = $this->makeActions($action); $actionReturn = null; $status = 0; foreach ($methods as $name => $method) { if ($objectRef->hasMethod($method)) { if ($name === 'default') { $status = 1; } // 方法存在 $methodRef = $this->_reflection->getMethod($method); if ($name === 'default') { $status = 2; } // if (!$methodRef->isStatic() && is_callable([$this, $method]) && !$this->web->isRender()) { if ($name === 'default') { $status = 3; } // $return = call_user_func_array([$this, $method], $args); if ($return !== null && !$return instanceof Controller && !$return instanceof Renderer) { $actionReturn = $return; } } } if ($status === 0 && $name === 'default') { $this->onMissing($method); } } $this->defaultReturn(...(array) $actionReturn); return $this; }