private function getDbConfig() {
        if (file_exists(MODULES_DIR . DS . $this->currentRoute['module'] . '/Config/database.php')) {
            $dbConfig = require_once MODULES_DIR . DS . $this->currentRoute['module'] . '/Config/database.php';

            if (!empty($dbConfig) && is_array($dbConfig)) {
                return $dbConfig;
            } else {
                throw new \Exception(ExceptionMessages::INCORRECT_CONFIG);
            }
        } else {
            if (file_exists(BASE_DIR . '/config/database.php')) {
                $dbConfig = require_once BASE_DIR . '/config/database.php';
                if (!empty($dbConfig) && is_array($dbConfig)) {
                    return $dbConfig;
                } else {
                    throw new \Exception(ExceptionMessages::INCORRECT_CONFIG);
                }
            } else {
                throw new \Exception(ExceptionMessages::DB_CONFIG_NOT_FOUND);
            }
        }
    }
private function getDbConfig() {
        if (file_exists(MODULES_DIR . DS . $this->currentRoute['module'] . '/Config/database.php')) {
            $dbConfig = require_once MODULES_DIR . DS . $this->currentRoute['module'] . '/Config/database.php';

            if (!empty($dbConfig) && is_array($dbConfig)) {
                return $dbConfig;
            } else {
                throw new \Exception(ExceptionMessages::INCORRECT_CONFIG);
            }
        } else {
            if (file_exists(BASE_DIR . '/config/database.php')) {
                $dbConfig = require_once BASE_DIR . '/config/database.php';
                if (!empty($dbConfig) && is_array($dbConfig)) {
                    return $dbConfig;
                } else {
                    throw new \Exception(ExceptionMessages::INCORRECT_CONFIG);
                }
            } else {
                throw new \Exception(ExceptionMessages::DB_CONFIG_NOT_FOUND);
            }
        }
    }
private function getDbConfig ( ) { if ( file_exists ( MODULES_DIR . DS . $ this -> currentRoute [ 'module' ] . '/Config/database.php' ) ) { $ dbConfig = require_once MODULES_DIR . DS . $ this -> currentRoute [ 'module' ] . '/Config/database.php' ; if ( ! empty ( $ dbConfig ) && is_array ( $ dbConfig ) ) { return $ dbConfig ; } else { throw new \ Exception ( ExceptionMessages :: INCORRECT_CONFIG ) ; } } else { if ( file_exists ( BASE_DIR . '/config/database.php' ) ) { $ dbConfig = require_once BASE_DIR . '/config/database.php' ; if ( ! empty ( $ dbConfig ) && is_array ( $ dbConfig ) ) { return $ dbConfig ; } else { throw new \ Exception ( ExceptionMessages :: INCORRECT_CONFIG ) ; } } else { throw new \ Exception ( ExceptionMessages :: DB_CONFIG_NOT_FOUND ) ; } } }
Get DB Config

Gets db configs from current config/database.php of module or
from top config/database.php if in module it's not defined

@return array
@throws \Exception When config is not found or incorrect
Get DB Config