serviceCache[$serviceClass])) { $this->serviceCache[$serviceClass] = new $serviceClass(); } return $this->serviceCache[$serviceClass]; } /** * 快捷调用某服务下某个方法 * * @param string $serviceClass * @param string $method * @param array $args * @return mixed */ protected function callServiceMethod(string $serviceClass, string $method, array $args = []): mixed { $service = $this->callService($serviceClass); if (!method_exists($service, $method)) { throw new \BadMethodCallException("Method {$method} does not exist in {$serviceClass}"); } return call_user_func_array([$service, $method], $args); } }