config = $config; $this->init(); } /** * OpenWebConfig constructor. */ public function init() { if ($this->init) { return; } $this->init = true; $this->appId = $this->config->getConfig('web.appid', ''); $this->secret = $this->config->getConfig('web.secret', ''); $this->token = $this->config->getConfig('web.token', ''); $this->aesKey = $this->config->getConfig('web.key', ''); } /** * 获取配置 * @param string $key * @param null $default * @return mixed */ public function getConfig(string $key, $default = null) { return $this->config->getConfig($key, $default); } /** * @return array */ #[ArrayShape([ 'app_id' => "string", 'secret' => "string", 'token' => "string", 'aes_key' => "string", 'http' => "bool[]" ])] #[Pure] public function all(): array { return [ 'app_id' => $this->appId, 'secret' => $this->secret, 'token' => $this->token, 'aes_key' => $this->aesKey, 'http' => $this->config->all() ]; } }