default = $config; $this->configContainer = [$config->getAppKey() => $config]; } else { if (empty($config)) { throw new YopClientException("config is empty."); } $this->configContainer = []; $this->default = $config[0]; foreach ($config as $item) { $this->configContainer[$item->getAppKey()] = $item; if ($item->isDefault()) { $this->default = $item; } } } } /** * @param $appKey string * @return AppSdkConfig */ public function getConfig($appKey) { return $this->configContainer[$appKey]; } /** * @return AppSdkConfig */ public function getDefaultConfig() { return $this->default; } /** * @return array */ public function getAllConfig() { return $this->configContainer; } }