public static function connection($name = null)
    {
        if (is_null($name) || strlen($name) == 0) {
            if (is_null(static::$name)) {
                static::$name = static::$config['default'];
            }

            $name = static::$name;
        }

        if (!isset(static::$config['connection'][$name])) {
            throw new ConnectionException('The connection "' . $name . '" is not defined.');
        }

        if ($name !== static::$name) {
            static::$adapter = null;
        }

        $config = static::$config['connection'][$name];

        static::$name = $name;

        if (static::$adapter === null) {
            if ($name == 'mysql') {
                static::$adapter = new MysqlAdapter($config);
            } elseif ($name == 'sqlite') {
                static::$adapter = new SqliteAdapter($config);
            } else {
                throw new ConnectionException('This driver is not praised');
            }

            static::$adapter->setFetchMode(static::$config['fetch']);
        }

        if (static::$adapter->getConnection() instanceof PDO && $name == static::$name) {
            return static::getInstance();
        }

        return static::getInstance();
    }