Connect adapter, model and adaptee.

@param string $adaptee

@return \Assely\Contracts\Adapter\AdapterInterface
507708
public function connectAdapter($adaptee)
    {
        $adapter = new $this->adapter($this->config);

        return $adapter
            ->setAdaptee($adaptee)
            ->setModel($this->model);
    }
408087
protected function createFlysystem(AdapterInterface $adapter, array $config)
    {
        $cache = ArrayHelper::pull($config, 'cache');
        $config = ArrayHelper::only($config, ['visibility', 'disable_asserts', 'url']);
        if ($cache) {
            $adapter = new CachedAdapter($adapter, $this->createCacheStore($cache));
        }
        return new Flysystem($adapter, count($config) > 0 ? $config : null);
    }
1102945
private function getAdapter(string $adapter = null, array $params, SymfonyStyle $inputOutput): Adapter
    {
        $adapterName = $adapter ?? $inputOutput->askQuestion(new AdapterChoice());
        $adapterName = strtolower($adapterName);

        if (empty($params)) {
            $questionGenerator = new AdapterQuestionProvider();
            foreach ($questionGenerator->getQuestionsFor($adapterName) as $question) {
                $params[] = $inputOutput->askQuestion($question);
            }
        }

        return $this->adapterFactory->build($adapterName, $params);
    }
1363648
public function getAdapter($name)
    {
        if (!isset($this->adapters[$name])) {
            throw new Exception\ConnectionException(
                "Adapter " . $name . " not registered on connection!"
            );
        }

        return $this->adapters[$name];
    }
723477
public static function getImplementationForAdapter($adapter)
    {
        if (!isset(self::$cacheAdapters[$adapter])) {
            $classname = __NAMESPACE__.'\\'.ucfirst($adapter);
            self::$cacheAdapters[$adapter] = new $classname();
        }
        return self::$cacheAdapters[$adapter];
    }
774590
public function authenticate( AdapterInterface $adapter = null )
    {
        $result = parent::authenticate( $adapter );

        if ( $result->isValid() )
        {
            $this->identityRefreshed = true;
        }

        return $result;
    }
603525
protected function createFlysystem(AdapterInterface $adapter, array $config)
    {
        if (class_exists('League\Flysystem\EventableFilesystem\EventableFilesystem')) {
            $fsClass = \League\Flysystem\EventableFilesystem\EventableFilesystem::class;
        } else {
            $fsClass = \League\Flysystem\Filesystem::class;
        }

        if (class_exists('League\Flysystem\Cached\CachedAdapter')) {
            $adapter = $this->decorateWithCachedAdapter($adapter, Arr::get($config, 'cache', []));
        }

        $config = Arr::only($config, ['visibility']);

        return new $fsClass($adapter, count($config) > 0 ? $config : null);
    }
774678
protected function serializeHasOne(Model $owner, Model $model = null, AdapterInterface $adapter)
    {
        return $this->serialize($model, $adapter);
    }
1026739
public function setProperAdapter($adapter)
    {
        switch ($adapter) {
            case 'apc':
                $adapter = '\Zest\Cache\Adapter\APC';
                break;
            case 'apcu':
                $adapter = '\Zest\Cache\Adapter\APCU';
                break;
            case 'file':
                $adapter = '\Zest\Cache\Adapter\FileCache';
                break;
            case 'memcache':
                $adapter = '\Zest\Cache\Adapter\Memcache';
                break;
            case 'memcached':
                $adapter = '\Zest\Cache\Adapter\Memcached';
                break;
            case 'redis':
                $adapter = '\Zest\Cache\Adapter\Redis';
                break;
            case 'session':
                $adapter = '\Zest\Cache\Adapter\SessionCache';
                break;

            default:
                $adapter = '\Zest\Cache\Adapter\FileCache';
                break;
        }

        $this->adapter = new $adapter();

        return $this;
    }
824745
protected function createFilesystem(AdapterInterface $adapter, array $config)
    {
        $cache = Arr::pull($config, 'cache');

        $config = Arr::only($config, ['visibility', 'disable_asserts', 'url']);

        if ($cache) {
            $adapter = new CachedAdapter($adapter, $this->createCacheStore($cache));
        }

        return new Filesystem($adapter, count($config) > 0 ? $config : null);
    }
836339
public static function getAdapter($adapter)
    {
        $config = Config::get('cache');

        if ($config && $adapter && isset($config['enabled']) && $config['enabled']) {
            if (!isset($config['pools'][$adapter])) {
                throw new ComponentException("Class `Proxy\\Cache` required configuration for `$adapter` adapter");
            }
            if (!isset(static::$pools[$adapter])) {
                static::$pools[$adapter] = $config['pools'][$adapter]();
            }
            return static::$pools[$adapter];
        }
        return false;
    }
1244011
public function setAdapter($adapter)
    {
        if (is_string($adapter)) {
            if (class_exists($adapter)) {
                $class = $adapter;
            } elseif (class_exists("PSchwisow\\Phergie\\Plugin\\UrlShorten\\Adapter\\{$adapter}")) {
                $class = "PSchwisow\\Phergie\\Plugin\\UrlShorten\\Adapter\\{$adapter}";
            } else {
                throw new \InvalidArgumentException("Class not found: '$adapter'");
            }
            $adapter = new $class;
        }

        if (!$adapter instanceof AbstractAdapter) {
            throw new \InvalidArgumentException(
                'Shortener service must extend PSchwisow\Phergie\Plugin\UrlShorten\Adapter\AbstractAdapter'
            );
        }
        $this->adapter = $adapter;

    }
1075575
public function prependAdapter(AdapterInterface $adapter)
    {
        $priority = self::DEFAULT_PRIORITY;

        if (!$this->adapters->isEmpty()) {
            $extractedNodes = $this->adapters->toArray(PriorityQueue::EXTR_PRIORITY);

            rsort($extractedNodes, SORT_NUMERIC);

            $priority = $extractedNodes[0] + 1;
        }

        $this->adapters->insert($adapter, $priority);

        return $this;
    }
275753
public static function flysystemFactory(array $adapter) {
		if (class_exists($adapter['adapterClass'])) {
			return (new ReflectionClass($adapter['adapterClass']))->newInstanceArgs($adapter['adapterOptions']);
		}

		$leagueAdapter = '\\League\\Flysystem\\Adapter\\' . $adapter['adapterClass'];
		if (class_exists($leagueAdapter)) {
			return (new ReflectionClass($leagueAdapter))->newInstanceArgs($adapter['adapterOptions']);
		}

		$leagueAdapter = '\\League\\Flysystem\\' . $adapter['adapterClass'] . '\\' . $adapter['adapterClass'] . 'Adapter';
		if (class_exists($leagueAdapter)) {
			return (new ReflectionClass($leagueAdapter))->newInstanceArgs($adapter['adapterOptions']);
		}

		throw new InvalidArgumentException('Unknown adapter');
	}
928290
protected static function getAdapter(?string $adapter = null): AbstractMailAdapter
    {
        $config = static::getConfig();

        if (static::$firstKey === null) {
            static::$firstKey = $config->getFirstKey();
        }

        $key = $adapter ?? static::$firstKey;
        $configArray = $config->get($key, []);

        if (($configArray['enabled'] ?? false) === true) {
            if (isset($configArray['module'])) {
                Application::registerModule($configArray['module']);
            }

            $className = $configArray['adapter_class'] ?? null;

            if ($className === null) {
                throw new ConfigException("Key 'adapter_class' is not set in mail config={$key}");
            }

            if (!class_exists($className, true)) {
                throw new ConfigException("Unknown mail class={$className} under key={$adapter}");
            }

            return new $className($configArray['options'] ?? []);
        }

        return new Simulate($configArray['options'] ?? []);
    }
1078048
public function merge(self $adapterManager): self
    {
        foreach ($adapterManager->getAdapters() as $adapterTmp => $callableFunctionTmp) {
            $this->validateAdapter($adapterTmp);
            $this->validateCallable($callableFunctionTmp);

            $key = \array_search($adapterTmp, $this->adapter, true);

            if ($key) {
                $this->adapter[$key] = $adapterTmp;
                $this->callableFunctions[$key] = $callableFunctionTmp;
            } else {
                $this->adapter[] = $adapterTmp;
                $this->callableFunctions[] = $callableFunctionTmp;
            }
        }

        return $this;
    }
1099950
public function mountFilesystem($prefix, AdapterInterface $adapter)
    {
        return $this->manager->mountFilesystem($prefix, new Fs($adapter));
    }