Updates configuration settings with collection of key value pairs.

@param array $settings

@return void
435455
public static function setMany($settings = [], $defaultSettings = [])
    {
        $settings = static::parseDefaultOptions($settings, $defaultSettings);

        array_walk($settings, function ($value, $key) {
            static::set($key, $value);
        });
    }
1114358
protected function resolveSettings(array $settings = [])
    {
        $defaultSettings = [
            'allow-credentiails' => false,
            'allow-headers'      => [],
            'expose-headers'     => [],
            'origins'            => [],
            'methods'            => [],
            'max-age'            => 0,
        ];

        $this->config->set([
            'cors' => array_merge($defaultSettings, $this->config->pull('cors')),
        ]);
    }
183341
protected function registerEntityManagers(array $settings)
    {
        if (array_key_exists('connection', $settings)) {
            $settings = [$settings];
        }

        foreach ($settings as $name => $config) {
            if (!is_string($name)) {
                $name = $this->getOption(static::RELATIONAL_MANAGER_NAME);
            }

            $this->addBuilder(new RelationalBuilder($config, $name));
        }
    }
1122833
public function initSettings(array $settings)
    {
        if (!isset($settings['tcp'])) {
            throw new \InvalidArgumentException('Tcp startup parameter is not configured，settings=' . \json_encode($settings));
        }

        if (!isset($settings['http'])) {
            throw new \InvalidArgumentException('HTTP startup parameters is not configured, settings=' . \json_encode($settings));
        }

        if (!isset($settings['server'])) {
            throw new \InvalidArgumentException('server startup parameters is not configured, settings=' . \json_encode($settings));
        }

        if (!isset($settings['setting'])) {
            throw new \InvalidArgumentException('"setting" parameters is not configured, settings=' . \json_encode($settings));
        }

        foreach ($settings['setting'] as $key => $value) {
            // path alias
            if ($value && \is_string($value) && $value[0] === '@') {
                $settings['setting'][$key] = App::getAlias($value);
            }
        }

        $this->setting = $settings['setting'];
        $this->tcpSetting = $settings['tcp'];
        $this->httpSetting = $settings['http'];
        $this->serverSetting = $settings['server'];

        // fix bug must to int
        if (isset($this->setting['task_ipc_mode'])) {
            $this->setting['task_ipc_mode'] = (int)$this->setting['task_ipc_mode'];
        }
        if (isset($this->setting['message_queue_key'])) {
            $this->setting['message_queue_key'] = (int)$this->setting['message_queue_key'];
        }
    }
299950
public static function setSettings( array $values )
	{
		foreach ($values as $name => $value)
			self::setSetting($name, $value);
	}
1107238
protected function addModelSettings(array &$settings)
    {
        $empty = $this->util->getTranslated()->getEmptyDropdownArray();

        $settings['elementClass'] = 'Select';
        $settings['multiOptions'] = $empty + $this->getLookup();
    }
344854
public function injectSettings(array $settings)
    {
        $this->sessionCookieName = $settings['session']['name'];
        $this->sessionCookieLifetime = (integer)$settings['session']['cookie']['lifetime'];
        $this->sessionCookieDomain = $settings['session']['cookie']['domain'];
        $this->sessionCookiePath = $settings['session']['cookie']['path'];
        $this->sessionCookieSecure = (boolean)$settings['session']['cookie']['secure'];
        $this->sessionCookieHttpOnly = (boolean)$settings['session']['cookie']['httponly'];
        $this->garbageCollectionProbability = $settings['session']['garbageCollection']['probability'];
        $this->garbageCollectionMaximumPerRun = $settings['session']['garbageCollection']['maximumPerRun'];
        $this->inactivityTimeout = (integer)$settings['session']['inactivityTimeout'];
    }
936045
public function injectSettings(array $settings = null) {
		$this->settings = ($settings === null) ? array() : $settings;

		// register default snippets
		$this->add(new DefaultSnippets());

		if (array_key_exists('snippets', $this->settings)) {
			foreach ($this->settings['snippets'] as $snippet=>$definition) {
				if ($definition instanceof Snippets) {
					$this->add($definition);
				} else {
					$this->add($snippet, $definition);
				}
			}
		}
	}
611345
public function setData(array $settings) : void
    {
        foreach ($settings as $key => $value) {
            $this->data[strtolower($key)] = $value;
        }
    }
674275
public function saveSettings($settings)
    {
        if (isset($settings['name']) && isset($this->config['servers'][$settings['name']])) {
            return $this->saveConfig(array_merge($this->config['servers'][$settings['name']], $settings));
        }
    }
1243830
protected function connect(array $settings): void
  {
    $host     = $this->getSetting($settings, true, 'database', 'host');
    $user     = $this->getSetting($settings, true, 'database', 'user');
    $password = $this->getSetting($settings, true, 'database', 'password');
    $database = $this->getSetting($settings, true, 'database', 'database');

    MetadataDataLayer::setIo($this->io);
    MetadataDataLayer::connect($host, $user, $password, $database);
  }
1317331
public function withSettings(array $settings): self
    {
        $this->settings = [];
        foreach ($settings as $name => $value) {
            $this->withSetting($name, $value);
        }

        return $this;
    }
453976
public function updateMany(array $settings)
    {
        // TODO Use DB::beginTransaction(), DB::rollback(), DB::commit() ?
        foreach ($settings as $k => $v) {
            if ($this->update($k, $v) === false) {
                return false;
            }
        }

        return true;
    }
958219
public static function settings($settings=array())
		{
			self::$_readOnce 		= isset($settings['readOnce']) ? (boolean) $settings['readOnce'] : false;
			self::$_defaultReturn 	= (array_key_exists('defaultReturn',$settings)) ? $settings['defaultReturn'] : 'ST__EXCEPTION';
		}
915016
public function injectSettings(array $settings) {
		if (isset($settings['server']['serviceBaseUri'])) {
			$this->serverServiceBaseUri = $settings['server']['serviceBaseUri'];
		}
		if (isset($settings['server']['keyPairFingerprint'])) {
			$this->serverKeyPairFingerprint = $settings['server']['keyPairFingerprint'];
		}
	}
351126
public function restore(array $settings = array())
    {
        $settings = array_values($settings);

        $reflection = new ReflectionMethod(get_class($this), '__construct');
        $alreadySet = $reflection->getNumberOfParameters();

        $index = 0;

        foreach($this->settings as &$setting)
        {
            if($alreadySet > $index)
            {
                continue;
            }

            if(array_key_exists($index, $settings))
            {
                $setting = $settings[$index] === '' ? NULL : $settings[$index];
            }

            $index++;
        }
    }
738866
public static function init($settings = null)
	{
		if (!is_null($settings))
			self::$settings = array_replace_recursive(self::$settings, $settings);
	}