Get the configuration for a connection.

@param  string  $name
@return array

@throws \InvalidArgumentException
345334
protected function getConfig($name)
	{
		$name = $name ?: $this->getDefaultConnection();

		// To get the database connection configuration, we will just pull each of the
		// connection configurations and get the configurations for the given name.
		// If the configuration doesn't exist, we'll throw an exception and bail.
		$connections = $this->app['config']['database.connections'];

		if (is_null($config = array_get($connections, $name)))
		{
			throw new InvalidArgumentException("Database [$name] not configured.");
		}

		return $config;
	}
119603
public function connection($name = null)
    {
        if (is_null($name)) {
            $name = $this->getDefaultConnection();
        }

        return $this->connections[$name];
    }
1340216
public function getConnection($name)
    {
        if (!$this->connectionSettings->has($name)) {
            throw new BadArgumentException('Connection with name ":name" not defined in configuration file ":file"', [
                'name' => $name, 'file' => ServiceLocator::instance()->getConfiguration()->getIdentity(),
            ]);
        }
        
        if (!static::$connections->has($name)) {
            static::$connections->set($name, new Connection($this->connectionSettings->get($name)));
        }
        
        return static::$connections[$name];
    }
614346
public function getConnectionConfig(string $name = null) {

        // Lookup the connection config
        $config = $this->config->get($this->getConfigName().'.disk');

        // Add cache info the config
        if ($this->config->get($this->getConfigName().'.cache')) {
            $config['cache'] = $this->getCacheConfig();
        }

        // Use the driver as the name.
        $config['name'] = $config['driver'];

        // Return adapter config in the format GrahamCampbell/Flysystem expects
        return $config;
    }
1191214
protected function _getConnection( $name )
	{
		if( !isset( $this->_connections[$name] ) ) {
			return $this->_conn;
		}

		return $this->_connections[$name];
	}
852342
public static function get_connector($name = 'default')
    {
        $connection = self::get_conn($name);
        if ($connection) {
            return $connection->getConnector();
        }
        return null;
    }
674472
public function getParameter($name)
    {
        $config = $this->get('config');
        if (!isset($config['parameters'][$name])) {
            throw new \InvalidArgumentException(sprintf('You have requested a non-existent parameter "%s".', $name));
        }

        return $config['parameters'][$name];
    }
785613
public function getBotConfig($name = null)
    {
        $name = $name ?: $this->getDefaultBot();

        $bots = $this->getConfig('bots');
        if (!is_array($config = array_get($bots, $name)) && !$config) {
            throw new InvalidArgumentException("Bot [$name] not configured.");
        }

        $config['bot'] = $name;

        return $config;
    }
125121
public function getConnection($name = 'default')
    {
        if (array_key_exists($name, $this->connections)) {
            return $this->connections[$name];
        }
        return null;
    }
220507
public function get($name)
    {
        $loader = $this->getLoader();
        $configurationKey = $loader->getConfigurationKey($name);
        $configuration = &static::$configurations[$configurationKey];
        if (!isset($configuration)) {
            $configuration = $loader->loadByKey($configurationKey);
        }

        return $configuration;
    }
122104
protected function getConnectionByName($name)
    {
        if (array_key_exists($name, $this->connectionByName)) {
            return $this->connectionByName[$name];
        }

        $event = clone $this->getManagerRegistryResourceEventPrototype();
        $event->setName(ManagerRegistryResourceEvent::RESOLVE_CONNECTION_EVENT);
        $event->setResourceName($name);
        $event->setTarget($this);


        $resultsEvent = $this->getEventManager()->trigger($event, function ($connection) {
            return is_object($connection);
        });

        $connection = $resultsEvent->last();

        if (!is_object($connection)) {
            $errMsg = sprintf('Connection %s not found', $name);
            throw new Exception\ConnectionNotFoundException($errMsg);
        }

        $this->connectionByName[$name] = $connection;

        return $this->connectionByName[$name];
    }
1153140
public function getConnection($name)
    {
        if (!$this->hasConnection($name)) {
            throw new \InvalidArgumentException(sprintf('The connection "%s" does not exist.', $name));
        }

        return $this->connections[$name];
    }
1127240
protected function resolve($name)
    {
        $options = Arr::get($this->config, 'options', []);

        if (isset($this->config[$name])) {
            return $this->connector()->connect($this->config[$name], $options);
        }

        if (isset($this->config['clusters'][$name])) {
            return $this->resolveCluster($name);
        }

        throw new \InvalidArgumentException(
            "Redis connection [{$name}] not configured."
        );
    }
970780
public function get($name = '')
	{
		// This needs to be extended by somebody else!
		if(!$this->_app->name)
			return [];

		// Not defined huh?
		if (!$this->_config)
			$this->getConfig();

		return $name ? (isset($this->_config['_'. $name]) ? $this->_config['_'. $name] : []) : $this->_config;
	}
393831
public function getConfig($name)
    {
        if (is_array($name)) {
            $config = $name;
            $name = uniqid();
            $this->setConfig($name, $config);
        }

        $name = trim($name);
        $name = $this->processRawCliConfig($name);

        if (!isset($this->configs[$name])) {
            throw new \InvalidArgumentException(sprintf(
                'No %s configuration named "%s" exists. Known configurations: "%s"',
                $this->serviceType,
                $name,
                implode('", "', array_keys($this->configs))
            ));
        }

        if (!isset($this->resolvedConfigs[$name])) {
            $this->resolveConfig($name);
        }

        return $this->resolvedConfigs[$name];
    }
1035226
final public function getDefaultPort($name)
	{
		$this->_getPortKey($name);
		if ($this->isNamedPort($name)) {
			return constant($this->_port_class . $name);
		} else {
			throw new \InvalidArgumentException("Unknown name or scheme: {$name}");
		}
	}
1188452
public static function getHostByName($name) {
        if (!is_string($name)) throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
        if ($name == '')       throw new InvalidArgumentException('Invalid argument $name: "'.$name.'"');

        return \gethostbyname($name);
    }