src/Arvici/Heart/Database/Database.php
public static function connection($name = 'default')
    {
        $databaseConfig = self::getConnectionConfiguration($name);

        /** @var Driver $driver */
        $driver = self::driver($name);

        $username = isset($databaseConfig['username']) ? $databaseConfig['username'] : null;
        $password = isset($databaseConfig['password']) ? $databaseConfig['password'] : null;
        $options = isset($databaseConfig['options']) ? $databaseConfig['options'] : array();

        // Create connection if we don't have it already
        if (! isset(self::$connections[$name])) {
            $connection = $driver->connect($databaseConfig, $username, $password, $options);

            self::$connections[$name] = $connection;
        }

        return self::$connections[$name];
    }
public static function connection($name = 'default')
    {
        $databaseConfig = self::getConnectionConfiguration($name);

        /** @var Driver $driver */
        $driver = self::driver($name);

        $username = isset($databaseConfig['username']) ? $databaseConfig['username'] : null;
        $password = isset($databaseConfig['password']) ? $databaseConfig['password'] : null;
        $options = isset($databaseConfig['options']) ? $databaseConfig['options'] : array();

        // Create connection if we don't have it already
        if (! isset(self::$connections[$name])) {
            $connection = $driver->connect($databaseConfig, $username, $password, $options);

            self::$connections[$name] = $connection;
        }

        return self::$connections[$name];
    }
public static function connection ( $ name = 'default' ) { $ databaseConfig = self :: getConnectionConfiguration ( $ name ) ; /** @var Driver $driver */ $ driver = self :: driver ( $ name ) ; $ username = isset ( $ databaseConfig [ 'username' ] ) ? $ databaseConfig [ 'username' ] : null ; $ password = isset ( $ databaseConfig [ 'password' ] ) ? $ databaseConfig [ 'password' ] : null ; $ options = isset ( $ databaseConfig [ 'options' ] ) ? $ databaseConfig [ 'options' ] : array ( ) ; // Create connection if we don't have it already if ( ! isset ( self :: $ connections [ $ name ] ) ) { $ connection = $ driver -> connect ( $ databaseConfig , $ username , $ password , $ options ) ; self :: $ connections [ $ name ] = $ connection ; } return self :: $ connections [ $ name ] ; }
Get connection instance for connection name.

@param string $name

@return Connection

@throws ConfigurationException
Get connection instance for connection name .