/** * Set setting information * * @param array $data setting data * @return void */ public function set(array $data) { $this->config = $this->cfg->set($this->key, $data); if (!$this->config->get('uuid')) { $this->config->set('uuid', $this->keygen->generate()); $this->cfg->modify($this->config); } }
public function testModifyThrowsExceptionWhenNotExists() { list($repo, $validator) = $this->getMocks(); $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity'); $mockConfig->siteKey = 'default'; $mockConfig->name = 'board.notice'; $repo->shouldReceive('find')->once()->with('default', 'board.notice')->andReturnNull(); $instance = new ConfigManager($repo, $validator); try { $instance->modify($mockConfig); $this->assertTrue(false); } catch (\Exception $e) { $this->assertInstanceOf('Xpressengine\\Config\\Exceptions\\NotExistsException', $e); } }
/** * Update menu item config consisting of theme identifiers * * @param MenuItem $item menu item instance * @param string $desktopTheme theme id * @param string $mobileTheme theme id * @return void */ public function updateMenuItemTheme(MenuItem $item, $desktopTheme, $mobileTheme) { $configKeyString = $this->menuKeyString($item); $config = $this->configs->get($configKeyString); $config->set('desktopTheme', $desktopTheme); $config->set('mobileTheme', $mobileTheme); $this->configs->modify($config); }
/** * putSiteConfig * * @param ConfigEntity $config site config entity * * @return void * @throws InvalidArgumentException */ public function putSiteConfig(ConfigEntity $config) { $this->config->modify($config); }
/** * 대상 instance 별 설정 * * @param string $instanceId instance identifier * @param array $information config information * @return void * @throws NotConfiguredException */ public function configure($instanceId, array $information) { $key = $this->getConfigKey($instanceId); if (!($config = $this->configs->get($key))) { throw new NotConfiguredException(); } $information = array_merge($this->defaultConfig, $information); // division 설정은 최초 인스턴스 생성시 결정되며 변경할 수 없다. $information = array_diff_key($information, array_flip(['division'])); foreach ($information as $name => $value) { $config->set($name, $value); } $this->configs->modify($config); }
/** * updatePageConfig * * @param ConfigEntity $config page config entity * * @return void * @throws \Xpressengine\Config\Exceptions\InvalidArgumentException */ public function updatePageConfig($config) { $this->configManager->modify($config); }