options === null) { $this->options = $this->extensionManager->getExtensionConfig('wechatpay'); if (empty($this->options)) { throw new \RuntimeException('微信支付配置不能为空'); } } return match ($name) { 'debug' => $this->options['debug'] ?? false, 'apiclient_cert' => $this->getKeyPath($this->options['apiclient_cert'][0]), 'apiclient_key' => Rsa::from($this->getKeyPath($this->options['apiclient_key'][0])), 'public_key' => Rsa::from($this->getKeyPath($this->options['public_key'][0]), Rsa::KEY_TYPE_PUBLIC), 'platform_cert' => isset($this->options['platform_cert'][0]) ? Rsa::from($this->getKeyPath($this->options['platform_cert'][0]), Rsa::KEY_TYPE_PUBLIC) : null, default => $this->options[$name] ?? null, }; } public function getKeyPath(string $name): string { return 'file://' . public_path() . $name; } }