public function getDefault()
    {
        // get the memoized default
        if ($this->default) {
            return $this->get($this->default);
        }

        // no configurations available
        // check for existing connections
        if (0 === count($this->config)) {
            if (1 === count($this->connections)) {
                $this->default = array_keys($this->connections)[0];

                return $this->get($this->default);
            } elseif (count($this->connections) > 1) {
                throw new JAQBException('Could not determine the default connection because multiple connections were available and the default has not been set.');
            }

            throw new JAQBException('The default connection is not available because no configurations have been supplied.');
        }

        // handle the case where there is a single configuration
        if (1 === count($this->config)) {
            $this->default = array_keys($this->config)[0];

            return $this->get($this->default);
        }

        // handle multiple configurations
        foreach ($this->config as $k => $v) {
            if (array_value($v, 'default')) {
                $this->default = $k;

                return $this->get($this->default);
            }
        }

        throw new JAQBException('There is no default connection.');
    }
public function getDefault()
    {
        // get the memoized default
        if ($this->default) {
            return $this->get($this->default);
        }

        // no configurations available
        // check for existing connections
        if (0 === count($this->config)) {
            if (1 === count($this->connections)) {
                $this->default = array_keys($this->connections)[0];

                return $this->get($this->default);
            } elseif (count($this->connections) > 1) {
                throw new JAQBException('Could not determine the default connection because multiple connections were available and the default has not been set.');
            }

            throw new JAQBException('The default connection is not available because no configurations have been supplied.');
        }

        // handle the case where there is a single configuration
        if (1 === count($this->config)) {
            $this->default = array_keys($this->config)[0];

            return $this->get($this->default);
        }

        // handle multiple configurations
        foreach ($this->config as $k => $v) {
            if (array_value($v, 'default')) {
                $this->default = $k;

                return $this->get($this->default);
            }
        }

        throw new JAQBException('There is no default connection.');
    }
public function getDefault ( ) { // get the memoized default if ( $ this -> default ) { return $ this -> get ( $ this -> default ) ; } // no configurations available // check for existing connections if ( 0 === count ( $ this -> config ) ) { if ( 1 === count ( $ this -> connections ) ) { $ this -> default = array_keys ( $ this -> connections ) [ 0 ] ; return $ this -> get ( $ this -> default ) ; } elseif ( count ( $ this -> connections ) > 1 ) { throw new JAQBException ( 'Could not determine the default connection because multiple connections were available and the default has not been set.' ) ; } throw new JAQBException ( 'The default connection is not available because no configurations have been supplied.' ) ; } // handle the case where there is a single configuration if ( 1 === count ( $ this -> config ) ) { $ this -> default = array_keys ( $ this -> config ) [ 0 ] ; return $ this -> get ( $ this -> default ) ; } // handle multiple configurations foreach ( $ this -> config as $ k => $ v ) { if ( array_value ( $ v , 'default' ) ) { $ this -> default = $ k ; return $ this -> get ( $ this -> default ) ; } } throw new JAQBException ( 'There is no default connection.' ) ; }
Gets the default database connection.

@throws JAQBException if there is not a default connection

@return QueryBuilder
Gets the default database connection .