Set the adapter for a given datasource.

@param string                                   $name    The datasource name
@param \Propel\Runtime\Adapter\AdapterInterface $adapter
174033
public function setAdapter($name, AdapterInterface $adapter)
    {
        $this->adapters[$name] = $adapter;
        $this->adapterClasses[$name] = get_class($adapter);
    }
98779
protected function decorateWithCachedAdapter(AdapterInterface $adapter, array $config)
    {
        if (
            ($cacheDriver = Arr::get($config, 'driver', false)) !== false &&
            (is_a($cacheDriver, 'League\Flysystem\Cached\CacheInterface') ||
                class_exists($driverName = Arr::get($this->cacheDrivers, $cacheDriver, $cacheDriver))
            )
        ) {
            if (isset($driverName)) {
                switch ($driverName) {
                    case 'League\Flysystem\Cached\Storage\Adapter':
                        $cacheDriver = new \League\Flysystem\Cached\Storage\Adapter($this->disk(Arr::get($config, 'disk', 'local'))->getAdapter(), Arr::get($config, 'file', 'flysystem.cache'), Arr::get($config, 'expire', null));
                        break;
                    case 'Madewithlove\IlluminatePsrCacheBridge\Laravel\CacheItemPool':
                        $cacheDriver = new \League\Flysystem\Cached\Storage\Psr6Cache(new \Madewithlove\IlluminatePsrCacheBridge\Laravel\CacheItemPool($this->app->make(\Illuminate\Contracts\Cache\Repository::class)), Arr::get($config, 'key', 'flysystem'), Arr::get($config, 'expire', null));
                        break;
                    case 'League\Flysystem\Cached\Storage\Memcached':
                        if (class_exists('Memcached')) {
                            $memcached = new \Memcached;
                            $memcached->addServer(Arr::get($config, 'host', 'localhost'), Arr::get($config, 'port', 11211));

                            $cacheDriver = new \League\Flysystem\Cached\Storage\Memcached($memcached, Arr::get($config, 'key', 'flysystem'), Arr::get($config, 'expire', null));
                        } else {
                            return $adapter;
                        }
                        break;
                    case 'League\Flysystem\Cached\Storage\Memory':
                        $cacheDriver = new \League\Flysystem\Cached\Storage\Memory;
                        break;
                    case 'League\Flysystem\Cached\Storage\Noop':
                        $cacheDriver = new \League\Flysystem\Cached\Storage\Noop;
                        break;
                    case 'League\Flysystem\Cached\Storage\PhpRedis':
                    case 'League\Flysystem\Cached\Storage\Predis':
                        $cacheDriver = new \League\Flysystem\Cached\Storage\Predis(\Illuminate\Support\Facades\Redis::connection(Arr::get($config, 'connection', 'default')), Arr::get($config, 'key', 'flysystem'), Arr::get($config, 'expire', null));
                        break;
                    case 'League\Flysystem\Cached\Storage\Stash':
                        if (class_exists('Stash\Pool')) {
                            if (($backend = Arr::get($config, 'backend', false)) !== false && (is_a($backend, 'Stash\Interfaces\DriverInterface') || class_exists($backend))) {
                                if (is_a($backend, 'Stash\Interfaces\DriverInterface')) {
                                    $backendInstance = $backend;
                                } else {
                                    $backendInstance = new $backend;
                                    $backendInstance->setOptions(Arr::get($config, 'options', []));
                                }

                                $pool = new \Stash\Pool($backendInstance);
                            } else {
                                $pool = new \Stash\Pool;
                            }

                            $cacheDriver = new \League\Flysystem\Cached\Storage\Stash($pool, Arr::get($config, 'key', 'flysystem'), Arr::get($config, 'expire', null));
                        } else {
                            return $adapter;
                        }
                        break;
                    default:
                        return $adapter;
                }
            }

            return new \League\Flysystem\Cached\CachedAdapter($adapter, $cacheDriver);
        } else {
            return $adapter;
        }
    }
826542
private static function executeAdapter($adapter, Request $request, array $config = null)
    {
        if (!in_array('Embed\\Adapters\\AdapterInterface', class_implements($adapter))) {
            throw new \InvalidArgumentException("The class '$adapter' must implements 'Embed\\Adapters\\AdapterInterface'");
        }

        if (call_user_func([$adapter, 'check'], $request)) {
            return new $adapter($request, $config);
        }

        return false;
    }
57381
public function setDefaultRenderer($name)
    {
        if (!\array_key_exists($name, $this->renderers)) {
            throw new \InvalidArgumentException(sprintf('Cannot set default exception renderer "%s". It does not exist.', $name));
        }

        $this->defaultRenderer = $name;
    }
848203
public function setConnection($name, ConnectionInterface $connection)
    {
        if (null !== $this->loggerCallable) {
            $connection->setLoggerCallable($this->loggerCallable);
            $connection->setLogDefault(array('connection' => $name));
        } else {
            $connection->setLoggerCallable(null);
        }

        $this->connections[$name] = $connection;
    }
977730
protected function _setResourceName( $name )
	{
		$config = $this->_context->getConfig();

		if( $config->get( 'resource/' . $name ) === null ) {
			$this->_resourceName = $config->get( 'resource/default', 'db' );
		} else {
			$this->_resourceName = $name;
		}
	}
1220953
public function setDataSource(DataSourceInterface $dataSource)
    {
        $this->dataSource = $dataSource;
        $this->dataSource->initialize($this);
    }
714251
protected function getAdapter($name)
    {
        if (!isset($this->adapters[$name])) {
            throw new AdapterException("Adapter for filesystem '$name' not found.");
        }

        return $this->adapters[$name];
    }
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__;
    }
1091293
public function setAdapter( tao_helpers_grid_Cell_Adapter $adapter)
    {
        $returnValue = (bool) false;

        
		if(!is_null($adapter)){
			$this->adapters[] = $adapter;
			$returnValue = true;
		}
        

        return (bool) $returnValue;
    }
1128400
public static function addAdapter(string $name, AdapterInterface $adapter) {
		$adapter = new Filesystem($adapter);
		if (static::$manager == NULL && empty(self::$filesystems)) {
			self::init();
		}
		self::$filesystems[$name] = $adapter;
		static::$manager->mountFilesystem($name, $adapter);
	}
352526
public function registerAdapter($name, $class)
    {
        if (!is_subclass_of($class, AdapterInterface::class)) {
            throw new \RuntimeException(sprintf(
                'Adapter class "%s" must implement ' . AdapterInterface::class,
                $class
            ));
        }
        $this->adapters[$name] = $class;

        return $this;
    }
307292
public function setAdapters($adapters)
    {
        $this->adapterClasses = [];
        $this->adapters = [];
        foreach ($adapters as $name => $adapter) {
            $this->setAdapter($name, $adapter);
        }
    }
480247
private function detectByName($name)
    {
        $detectedAdapter = null;

        foreach ($this->adapters as $adapter) {
            if ($adapter->getName() === $name) {
                $detectedAdapter = $adapter;
                break;
            }
        }

        return $detectedAdapter;
    }
1320975
public function initWithModelAndAdapter(Model $m, $adapter)
    {
        $this->adapter = $adapter;

        $this->model = $m;
        $this->model->printModel();

        $this->fm = Model::loadFunctionMap();

        $this->initialize();

        if (null !== $this->adapter) {
            try {
                $this->loadPolicy();
            } catch (\Exception $e) {
                // error intentionally ignored
            }
        }
    }
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
        );
    }
1295429
public function get($name)
    {
        if (!isset($this->adapters[$name])) {
            throw new \InvalidArgumentException(sprintf('No Adapter with name "%s" is registered.', $name));
        }

        return $this->adapters[$name];
    }