Restore effect state from array
@param array $settings
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++;
        }
    }
212943
protected function storeDateSettings($settings)
    {
        // Set up start/end dates:
        $from = empty($settings['from'])
            ? $this->stateManager->loadDate() : $settings['from'];
        $until = empty($settings['until']) ? null : $settings['until'];
        $this->setStartDate($from);
        $this->setEndDate($until);
    }
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')),
        ]);
    }
1340132
protected function combineSettings(array $settings)/*# : array */
    {
        return array_replace(
            $this->getBuilder()->getSettings(), // builder settings
            $this->getBuilder()->getDialect()->dialectSettings(), // dialect
            $settings,  // user settings
            $this->getSettings() // statement settings
        );
    }
162370
public static function overload(array $settings)
    {
        if (self::mustLoad()) {
            self::load();
        }
        foreach ($settings as $var=>$val) {
            self::set($var, $val);
        }
    }
1257984
public function settings(Array $settings = []) : Upload
    {
        foreach( $settings as $key => $val )
        {
            $this->settings[$key] = $val;
        }

        return $this;
    }
291914
public function addConfigSettings(array $settings) {
        $this->config = $this->arrayMergeRecursiveOverwrite(
            $this->config,
            $settings
        );

        return $this;
    }
935974
public function addSettings( $settings )
    {
        $this->settings = ArrayUtils::merge(
            $this->settings,
            ArrayUtils::iteratorToArray( $settings )
        );

        return $this;
    }
1070478
public function setSettings( $settings )
    {
        if ( ! empty( $settings ) )
        {
            foreach ( $settings as $name => $value )
            {
                $this->setSetting( $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;
    }
1046306
protected function updateSettings(array $settings)
    {
        $this->controlAccess('module_edit');

        $this->module->setSettings('export', $settings);
        $this->redirect('', $this->text('Settings have been updated'), 'success');
    }
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));
        }
    }
789620
private function constructSettings($settings) {
        $ret = [];

        if(array_key_exists('fields', $settings)) {
            $ret['_source'] = ['include' => $settings['fields']];
        }

        if(array_key_exists('sort', $settings)) {
            $ret['sort'] = array_map(function($x) { return [$x[0] => ['order' => $x[1] ? 'asc':'desc']]; }, $settings['sort']);
        }

        $valid_keys = ['size'];
        foreach($valid_keys as $key) {
            if(array_key_exists($key, $settings)) {
                $ret[$key] = $settings[$key];
            }
        }

        return $ret;
    }
233296
protected function addModelSettings(array &$settings)
    {
        $settings['elementClass']  = 'Date';
        $settings['dateFormat']    = $this->getDateFormat();
        $settings['storageFormat'] = $this->getStorageFormat();
        $settings['type']          = $this->type;
    }
603907
protected function setSettings(array $settings): void
    {
        $this->server->set(array_merge($this->defaultSettings, $this->settings, $settings));
    }
318955
private function applyOrders(array $settings): void
    {
        // Obtain a list of columns
        foreach ($settings as $column => $order) {
            $this->getSource()->addOrderBy($column, $order);
        }
    }
749937
public static function mergeWithDefaultSettings($settings)
    {
        if (empty($settings)) {
            return static::getDefaultSettings();
        }
        if (is_array($settings)) {
            return array_merge(static::getDefaultSettings(), $settings);
        }
        throw new Exception("Argument must be an array.");
    }