public function getDatabaseInfo(ServiceDbInterface $instance = null, $allow_override = true)
    {
        if (!isset($instance)) {
            /** @var EngineType $engine */
            $engine = $this->getEngineInstance();
            $instance = $engine->getServiceInstanceByInterface(
                ServiceDbInterface::class
            );

            if ($instance === false) {
                throw new \RuntimeException(
                    'Unable to find a service for the database instance.'
                );
            }
        }
        $database = $this->getServiceInstanceDatabase($instance);

        if (!$allow_override || !isset($this->databaseOverride)) {
            return $database;
        }

        // Process database overrides on the current db object.
        foreach (get_object_vars($this->databaseOverride) as $property => $value) {
            if (empty($value)) {
                continue;
            }
            $method = 'set' . ucwords($property);

            if (!method_exists($database, $method)) {
                continue;
            }
            $database = call_user_func_array(
                [$database, $method],
                [$value]
            );
        }

        return $database;
    }
public function getDatabaseInfo(ServiceDbInterface $instance = null, $allow_override = true)
    {
        if (!isset($instance)) {
            /** @var EngineType $engine */
            $engine = $this->getEngineInstance();
            $instance = $engine->getServiceInstanceByInterface(
                ServiceDbInterface::class
            );

            if ($instance === false) {
                throw new \RuntimeException(
                    'Unable to find a service for the database instance.'
                );
            }
        }
        $database = $this->getServiceInstanceDatabase($instance);

        if (!$allow_override || !isset($this->databaseOverride)) {
            return $database;
        }

        // Process database overrides on the current db object.
        foreach (get_object_vars($this->databaseOverride) as $property => $value) {
            if (empty($value)) {
                continue;
            }
            $method = 'set' . ucwords($property);

            if (!method_exists($database, $method)) {
                continue;
            }
            $database = call_user_func_array(
                [$database, $method],
                [$value]
            );
        }

        return $database;
    }
public function getDatabaseInfo ( ServiceDbInterface $ instance = null , $ allow_override = true ) { if ( ! isset ( $ instance ) ) { /** @var EngineType $engine */ $ engine = $ this -> getEngineInstance ( ) ; $ instance = $ engine -> getServiceInstanceByInterface ( ServiceDbInterface :: class ) ; if ( $ instance === false ) { throw new \ RuntimeException ( 'Unable to find a service for the database instance.' ) ; } } $ database = $ this -> getServiceInstanceDatabase ( $ instance ) ; if ( ! $ allow_override || ! isset ( $ this -> databaseOverride ) ) { return $ database ; } // Process database overrides on the current db object. foreach ( get_object_vars ( $ this -> databaseOverride ) as $ property => $ value ) { if ( empty ( $ value ) ) { continue ; } $ method = 'set' . ucwords ( $ property ) ; if ( ! method_exists ( $ database , $ method ) ) { continue ; } $ database = call_user_func_array ( [ $ database , $ method ] , [ $ value ] ) ; } return $ database ; }
Get database information based on services.

@param ServiceDbInterface|null $instance
Instance of the environment engine DB service.
@param bool $allow_override
Set if to false to not include overrides.

@return DatabaseInterface
Get database information based on services .