protected function parseDatabase(array $options)
    {
        // Make sure prefix ends with underscore
        if (substr($options['prefix'], strlen($options['prefix']) - 1) !== '_') {
            $options['prefix'] .= '_';
        }

        // Parse master connection parameters
        $master = $this->parseConnectionParams($options);
        // Merge master connection into options
        $options = array_replace($options, $master);

        // Add platform specific random functions
        $driver = \Bolt\Common\Str::replaceFirst($options['driver'], 'pdo_', '');
        if ($driver === 'sqlite') {
            $options['driver'] = 'pdo_sqlite';
            $options['randomfunction'] = 'RANDOM()';
        } elseif (in_array($driver, ['mysql', 'mysqli'])) {
            $options['driver'] = 'pdo_mysql';
            $options['randomfunction'] = 'RAND()';
        } elseif (in_array($driver, ['pgsql', 'postgres', 'postgresql'])) {
            $options['driver'] = 'pdo_pgsql';
            $options['randomfunction'] = 'RANDOM()';
        }

        // Specify the wrapper class for the connection
        $options['wrapperClass'] = Database\Connection::class;

        // Parse SQLite separately since it has to figure out database path
        if ($driver === 'sqlite') {
            return $this->parseSqliteOptions($options);
        }

        // If no slaves return with single connection
        if (empty($options['slaves'])) {
            return $options;
        }

        // Specify we want a master slave connection
        $options['wrapperClass'] = Database\MasterSlaveConnection::class;

        // Add master connection where MasterSlaveConnection looks for it.
        $options['master'] = $master;

        // Parse each slave connection parameters
        foreach ($options['slaves'] as $name => $slave) {
            $options['slaves'][$name] = $this->parseConnectionParams($slave, $master);
        }

        return $options;
    }
protected function parseDatabase(array $options)
    {
        // Make sure prefix ends with underscore
        if (substr($options['prefix'], strlen($options['prefix']) - 1) !== '_') {
            $options['prefix'] .= '_';
        }

        // Parse master connection parameters
        $master = $this->parseConnectionParams($options);
        // Merge master connection into options
        $options = array_replace($options, $master);

        // Add platform specific random functions
        $driver = \Bolt\Common\Str::replaceFirst($options['driver'], 'pdo_', '');
        if ($driver === 'sqlite') {
            $options['driver'] = 'pdo_sqlite';
            $options['randomfunction'] = 'RANDOM()';
        } elseif (in_array($driver, ['mysql', 'mysqli'])) {
            $options['driver'] = 'pdo_mysql';
            $options['randomfunction'] = 'RAND()';
        } elseif (in_array($driver, ['pgsql', 'postgres', 'postgresql'])) {
            $options['driver'] = 'pdo_pgsql';
            $options['randomfunction'] = 'RANDOM()';
        }

        // Specify the wrapper class for the connection
        $options['wrapperClass'] = Database\Connection::class;

        // Parse SQLite separately since it has to figure out database path
        if ($driver === 'sqlite') {
            return $this->parseSqliteOptions($options);
        }

        // If no slaves return with single connection
        if (empty($options['slaves'])) {
            return $options;
        }

        // Specify we want a master slave connection
        $options['wrapperClass'] = Database\MasterSlaveConnection::class;

        // Add master connection where MasterSlaveConnection looks for it.
        $options['master'] = $master;

        // Parse each slave connection parameters
        foreach ($options['slaves'] as $name => $slave) {
            $options['slaves'][$name] = $this->parseConnectionParams($slave, $master);
        }

        return $options;
    }
protected function parseDatabase ( array $ options ) { // Make sure prefix ends with underscore if ( substr ( $ options [ 'prefix' ] , strlen ( $ options [ 'prefix' ] ) - 1 ) !== '_' ) { $ options [ 'prefix' ] .= '_' ; } // Parse master connection parameters $ master = $ this -> parseConnectionParams ( $ options ) ; // Merge master connection into options $ options = array_replace ( $ options , $ master ) ; // Add platform specific random functions $ driver = \ Bolt \ Common \ Str :: replaceFirst ( $ options [ 'driver' ] , 'pdo_' , '' ) ; if ( $ driver === 'sqlite' ) { $ options [ 'driver' ] = 'pdo_sqlite' ; $ options [ 'randomfunction' ] = 'RANDOM()' ; } elseif ( in_array ( $ driver , [ 'mysql' , 'mysqli' ] ) ) { $ options [ 'driver' ] = 'pdo_mysql' ; $ options [ 'randomfunction' ] = 'RAND()' ; } elseif ( in_array ( $ driver , [ 'pgsql' , 'postgres' , 'postgresql' ] ) ) { $ options [ 'driver' ] = 'pdo_pgsql' ; $ options [ 'randomfunction' ] = 'RANDOM()' ; } // Specify the wrapper class for the connection $ options [ 'wrapperClass' ] = Database \ Connection :: class ; // Parse SQLite separately since it has to figure out database path if ( $ driver === 'sqlite' ) { return $ this -> parseSqliteOptions ( $ options ) ; } // If no slaves return with single connection if ( empty ( $ options [ 'slaves' ] ) ) { return $ options ; } // Specify we want a master slave connection $ options [ 'wrapperClass' ] = Database \ MasterSlaveConnection :: class ; // Add master connection where MasterSlaveConnection looks for it. $ options [ 'master' ] = $ master ; // Parse each slave connection parameters foreach ( $ options [ 'slaves' ] as $ name => $ slave ) { $ options [ 'slaves' ] [ $ name ] = $ this -> parseConnectionParams ( $ slave , $ master ) ; } return $ options ; }
Parse and fine-tune the database configuration.

@param array $options

@return array
Parse and fine - tune the database configuration .