protected function resolve($name)
    {
        $config = $this->disks[$name];
        if (isset($config['class'])) {
            return Yii::createObject($config);
        } else if (isset($config['adapter'])) {
            $driverMethod = 'create' . ucfirst($config['adapter']) . 'Adapter';
            if (method_exists($this, $driverMethod)) {
                return $this->{$driverMethod}($config);
            } else {
                throw new InvalidArgumentException("Adapter [{$config['adapter']}] is not supported.");
            }
        } else {
            throw new InvalidArgumentException("Wrong adapter configuration.");
        }
    }