Registers an adapter.

@param  array|\mako\gatekeeper\adapters\AdapterInterface $adapter Array containing the adapter name and closure factory or an adapter instance
@return string
970771
protected function registerAdapter($adapter): string
	{
		if($adapter instanceof AdapterInterface)
		{
			return $this->registerAdapterInstance($adapter);
		}

		[$name, $factory] = $adapter;

		return $this->registerAdapterFactory($name, $factory);
	}
640232
public function setAdapter(AdapterInterface $adapter)
    {
        $adapter->setClient($this);

        $this->adapter = $adapter;

        return $this;
    }
784587
private function getFactoryObject($name)
    {
        if (!isset($this->adapters[$name])) {
            throw new \InvalidArgumentException(sprintf('No Adapter with name "%s" is registered.', $name));
        }

        if (!is_object($this->adapters[$name]['factory'])) {
            $factory = $this->adapters[$name]['factory'];

            $this->adapters[$name]['factory'] = new $factory();
        }

        return $this->adapters[$name]['factory'];
    }
868593
public function defaultAdapter($adapterKey)
    {
        $exists = false;
        if (in_array($adapterKey, $this->rendererAdapters->keys())) {
            $this->defaultAdapter = $adapterKey;
            $exists = true;
        }

        return $exists;
    }
259291
public function adapter(?string $name = null): AdapterInterface
	{
		$name = $name ?? $this->defaultAdapter;

		return $this->adapters[$name] ?? $this->adapterFactory($name);
	}
1304034
public function setCacheAdapter(AdapterAbstract $adapter)
    {
        if ($this->isSetup) {
            $e = new ApplicationIsAlreadySetupException('You cannot set the cache after calling setup()');
            $this->error($e);
        }

        $this->cache = $adapter;
    }
765937
public static function setAdapter($adapter)
    {
        switch (strtolower($adapter)) {
            case 'sodium':
                $adapterSet = '\Zest\Encryption\Adapter\SodiumEncryption';
                break;
            case 'openssl':
                $adapterSet = '\Zest\Encryption\Adapter\OpenSslEncryption';
                break;
            default:
                $adapterSet = '\Zest\Encryption\Adapter\OpenSslEncryption';
                break;
        }
        $key = __config()->encryption->key;
        self::$adapter = new $adapterSet($key);

        return __CLASS__;
    }
26795
public static function fromAdaptee($adaptee)
    {
        $type = is_object($adaptee) ? get_class($adaptee) . ' objects' : gettype($adaptee) . ' variables';

        return new self("There is no container adapter registered to handle {$type}.");
    }
986238
protected static function adapter($adapter, array $vars)
    {
        if (class_exists($adapter)) {
            return (new \ReflectionClass($adapter))->newInstanceArgs($vars);
        }

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

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

        throw new \InvalidArgumentException('Unknown adapter');
    }
149620
public function getAdapters(array $adapters = []): array
    {
        if (empty($adapter)) {
            return $this->adapter;
        }
        $list = [];
        foreach ($adapter as $name) {
            if (!$this->hasAdapter($name)) {
                throw new Exception\AdapterNotFound('auth adapter '.$name.' is not registered');
            }
            $list[$name] = $this->adapter[$name];
        }

        return $list;
    }
13223
protected function createAdapter(string $adapter, array $config): Adapter
    {
        if ($adapter === 'Local') {
            if (! isset($config['config']['path'])) {
                throw new RuntimeException('Filesystem local adapter must set `path`');
            }

            $config = [$config['config']['path']];
        }

        return Reflection::newInstance(
            'One\\FileSystem\\Adapters\\' . $adapter,
            $config
        );
    }
307448
public function setAdapter(AdapterInterface $adapter)
    {
        $this->adapter = $adapter;
        $this->connection = new Connection($this->adapter);
    }
1246474
private function loadAdapter($adapterName, $configName, array $adapterConfig, ContainerBuilder $container)
    {
        if (isset($adapterConfig['service'])) {
            // Custom adapter service.
            $container->setAlias($adapterName, Utility::cleanServiceName($adapterConfig['service']));
            return $this;
        }

        // Built-In Adapter
        switch ($adapterConfig['type']) {
            case 'jsonapiorg':
                $definition = $this->createJsonApiAdapter($configName, $container);
                break;
            default:
                throw new \RuntimeException(sprintf('The adapter type "%s" is currently not supported.', $adapterConfig['type']));
        }
        $container->setDefinition($adapterName, $definition);
        return $this;

    }
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);
    }
210069
protected function registerAdapterPlugger()
    {
        $this->app->bind('adapter.plugger', function ($app) {
            $collection = new Collection;

            return new AdapterPlugger($collection, $app['config']);
        });

        $this->app->alias('adapter.plugger', AdapterPlugger::class);
    }
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;
    }
799299
public function initAdapter()
    {
        $adapterClassName = $this->getOption('adapter_class_name');

        if (!$this->adapter || !is_a($this->adapter, $adapterClassName)) {
            if (!is_a($adapterClassName, AdapterInterface::class, true)) {
                throw new RendererException(
                    "Passed adapter class $adapterClassName is ".
                    'not a valid '.AdapterInterface::class
                );
            }
            $this->adapter = new $adapterClassName($this, $this->getOptions());
        }

        return $this;
    }