private function resolveOneDriver($driver)
    {
        if (empty($driver)) {
            throw new InvalidArgumentException(
                'Driver is empty'
            );
        }

        if (is_object($driver)) {
            if ($driver instanceof DriverInterface) {
                return $driver;
            } else {
                throw new InvalidArgumentException(sprintf(
                    'Driver class %s must implement %s',
                    get_class($driver),
                    DriverInterface::class
                ));
            }
        }

        $name = $driver;
        if (isset($this->drivers[$name])) {
            $driver = $this->drivers[$name];

            if (empty($driver)) {
                throw new InvalidArgumentException(
                    sprintf('Driver "%s" does not exist', $name)
                );
            }

            if (is_object($driver)) {
                if ($driver instanceof DriverInterface) {
                    return $driver;
                } else {
                    throw new InvalidArgumentException(sprintf(
                        'Driver "%s": Class %s must implement %s',
                        $name,
                        get_class($driver),
                        DriverInterface::class
                    ));
                }
            }
        }

        if (is_a($driver, DriverInterface::class, true)) {
            return new $driver();
        }

        throw new InvalidArgumentException(
            sprintf('Driver "%s" cannot be resolved', $name)
        );
    }