TODO

@param array $config
@return bool
544028
public function connect($config = array())
    {
        // TODO: Implement connect() method.
        if (isset($config['database']['cache'])) {
            $configCache = $config['database']['cache'];
            $this->conn = new \Memcache();
            if ($this->conn->connect($configCache['host'], $configCache['port'], $configCache['timeout'])) {
                $this->connected = true;
                return true;
            }
        }
        return false;
    }
918499
static public function setConfig(array $config)
    {
        foreach ($config as $k => $v) {
            self::$_config[$k] = $v;
        }
    }
320392
protected function normalizeConfig(array $config)
    {
        $final = [];
        foreach ($config as $key => $value) {
            if (is_array($value)) {
                $final[$key] = $this->normalizeConfig($value);
            } else {
                $final[$value] = [];
            }
        }

        return $final;
    }
151050
public static function configure(array $config)
    {
        static::$config = $config;

        if (is_null(static::$mounted)) {
            static::$mounted = static::mount($config['disk']['mount']);
        }

        return static::$mounted;
    }
672666
protected function validateConfiguration(array $config) : bool
    {
        if (!is_array($config)) {
            throw new DatabaseConnectionException('Could not load LDAP configuration settings.');
        }
        $config_keys = array_keys($config);
        $missing = array_diff(['server', 'port', 'domain', 'base_dn', 'username', 'password'], $config_keys);
        if (count($missing) > 0) {
            throw new DatabaseConnectionException('LDAP configuration missing ' . implode(', ', $missing));
        }
        return true;
    }
839100
public function check(array $config): bool
    {
        // we dont use the phpversion function because that adds more data to the number (Like: -1+ubuntu16.04)
        // that conflicts with the semver check
        return Semver::satisfies(
            PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION,
            $this->getRequiredPhpConstraint()
        );
    }
768545
protected function _checkSearchConfig( array $config )
	{
		$required = array( 'id', 'label', 'status', 'level', 'left', 'right' );

		foreach( $required as $key => $entry )
		{
			if( isset( $config[$entry] ) ) {
				unset( $required[$key] );
			}
		}

		if( count( $required ) > 0 )
		{
			$msg = 'Search config in given configuration are missing: "%1$s"';
			throw new MW_Tree_Exception( sprintf( $msg, implode( ', ', $required ) ) );
		}
	}
1202924
public function addFieldsFromConfig(array $config)
    {
        $i = 1;
        foreach ($config as $name => $field) {
            if (is_numeric($name) && !isset($field[$name]['type'])) {
                $fields = [];
                foreach ($field as $n => $f) {
                    $fields[$n] = Fields::create($n, $f);
                }
                if ($i > 1) {
                    $this->fieldsets[$this->current]->createGroup();
                }
                $this->fieldsets[$this->current]->addFields($fields);
                $i++;
            } else {
                $this->addField(Fields::create($name, $field));
            }
        }
        return $this;
    }
30522
public function connect(array $config)
    {
        $port = (isset($config['port'])) ? (int) $config['port'] : 21; //端口号
        $this->linkid = ftp_connect($config['service'], $port);
        if (!$this->linkid) {
            return false;
        }
        @ftp_set_option($this->linkid, FTP_TIMEOUT_SEC, $this->timeout);
        if (@!ftp_login($this->linkid, $config['username'], $config['password'])) {
            return false;
        }

        return true;
    }
1325038
public function put(array $config)
    {
        foreach ($config as $key => $value) {
            $this->set($key, $value);
        }

        return $this;
    }
1155939
protected function prepareConfig(array $config)
    {
        $config = new Config($config);
        $config->setFallback($this->getConfig());

        return $config;
    }
1206294
private function convert(array $config)
    {
        foreach ($config as $index => $data) {
            if (is_array($data)) {
                $config[$index] = new Config($data);
            }
        }

        return $config;
    }
364569
public function setConfig(array $config)
    {
        $this->config = $config;
        $this->senderID = $this->config['default_sender'];

        // The user may have called setConfig() manually,
        // and the array may have missing arguments.
        // So, we're checking whether they are set, and filling them if not set
        // Critical ones will throw exceptions, non-critical ones will set default values
        if (!isset($this->config['auth'])) {
            throw new \Exception($this->lang['exceptions']['0']);
        } else {
            if (!isset($this->config['auth']['username']) || !isset($this->config['auth']['password'])) {
                throw new \Exception($this->lang['exceptions']['1']);
            }
        }
        if (!isset($this->config['default_sender'])) {
            throw new \Exception($this->lang['exceptions']['2']);
        }
        if (!isset($this->config['queue'])) {
            $this->config['queue'] = false;
        }
        if (!isset($this->config['charset'])) {
            $this->config['charset'] = 'default';
        }
        if (!isset($this->config['append_unsubscribe_link'])) {
            $this->config['append_unsubscribe_link'] = false;
        }
        return $this;
    }
151246
private function validate(array $config = [])
    {
        $customfields = [];
        foreach ($config as $classname => $customfield) {
            if (!class_exists($classname)) {
                continue;
            }
            array_push($customfields, $customfield);
        }
        return !empty($customfields);
    }
1168441
public function applyConfig(array $config)
    {
        if (isset($config['description'])) {
            $this->description = $config['description'];
        }

        if (isset($config['default'])) {
            $this->defaultValue = $config['default'];
        }

        if (isset($config['required'])) {
            $this->required = (boolean) $config['required'];
        }
    }
1041946
public function config($config)
    {
        if (is_array($config)) {
            $this->config = array_merge($this->config, $config);
        } elseif (isset($this->config[$config])) {
            return $this->config[$config];
        } else {
            return;
        }
    }
768815
public static function configure(array $config)
    {
        if (!is_null(static::$instance)) {
            return static::$instance;
        }

        static::$config = $config;

        static::$session = Session::getInstance();

        return static::$instance = new Auth($config[$config['default']]);
    }