Create a default adapter to use based on the environment
@throws \RuntimeException
978284
private function getDefaultAdapter()
    {
        if (extension_loaded('curl')) {
            $this->parallelAdapter = new MultiAdapter($this->messageFactory);
            $this->adapter = function_exists('curl_reset')
                ? new CurlAdapter($this->messageFactory)
                : $this->parallelAdapter;
            if (ini_get('allow_url_fopen')) {
                $this->adapter = new StreamingProxyAdapter(
                    $this->adapter,
                    new StreamAdapter($this->messageFactory)
                );
            }
        } elseif (ini_get('allow_url_fopen')) {
            $this->adapter = new StreamAdapter($this->messageFactory);
        } else {
            throw new \RuntimeException('Guzzle requires cURL, the '
                . 'allow_url_fopen ini setting, or a custom HTTP adapter.');
        }
    }
790096
private function config()
    {
        if (realpath($this->configPath) !== false) {
            $json = file_get_contents($this->configPath);
            $this->config = json_decode($json);
            $this->config->rootDir = $this->rootDir;
        } else {
            throw new \RuntimeException('Framework not initialized yet. Consider running composer install');
        }
    }
1267374
protected function createResource()
    {
        $resource = $this->connect($this->configuration->asArguments());

        if (!is_resource($resource)) {
            throw new RuntimeException('The SSH connection failed.');
        }

        $this->resource = $resource;

        if (null !== $this->authentication) {
            $this->authenticate();
        }
    }
107687
public function getAdapter($name = null)
    {
        if (null === $name) {
            $name = $this->getDefaultDatasource();
        }
        if (!isset($this->adapters[$name])) {
            if (!isset($this->adapterClasses[$name])) {
                throw new AdapterException(sprintf('No adapter class defined for datasource "%s"', $name));
            }
            $this->adapters[$name] = AdapterFactory::create($this->adapterClasses[$name]);
        }

        return $this->adapters[$name];
    }
185965
public function getAdapter()
    {
        if (isset($this->adapter)) {
            return $this->adapter;
        }
        if (isset($this->options['connection'])) {
            if (!($this->options['connection'] instanceof \PDO)) {
                throw new \RuntimeException('The specified connection is not a PDO instance');
            }

            $this->options['connection']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
            $this->options['adapter'] = $this->options['connection']->getAttribute(\PDO::ATTR_DRIVER_NAME);
        }
        if (!isset($this->options['adapter'])) {
            throw new \RuntimeException('No adapter was specified for environment: ' . $this->getName());
        }

        $factory = AdapterFactory::instance();
        $adapter = $factory
            ->getAdapter($this->options['adapter'], $this->options);

        // Automatically time the executed commands
        $adapter = $factory->getWrapper('timed', $adapter);

        if (isset($this->options['wrapper'])) {
            $adapter = $factory
                ->getWrapper($this->options['wrapper'], $adapter);
        }

        if ($this->getCommand()) {
            $adapter->setCommand($this->getCommand());
        }

        // Use the TablePrefixAdapter if table prefix/suffixes are in use
        if ($adapter->hasOption('table_prefix') || $adapter->hasOption('table_suffix')) {
            $adapter = AdapterFactory::instance()
                ->getWrapper('prefix', $adapter);
        }

        $this->setAdapter($adapter);

        return $adapter;
    }
355087
private function bootAdapters()
	{
		// include all adapters
		foreach (glob(__DIR__ . DS . 'Import' . DS . 'Adapter' . DS . '*.php') as $adapter)
		{
			require_once $adapter;
		}

		// anonymous function to get adapters
		$isAdapterClass = function($class)
		{
			return (in_array('Hubzero\Content\Import\Adapter', class_implements($class)));
		};

		// set our adapters (any declared class implementing the ResourcesImportInterface)
		$this->adapters = array_values(array_filter(get_declared_classes(), $isAdapterClass));
	}
1103756
public function getOptions()
    {
        if (!$this->options) {
            throw new Exception\RuntimeException(sprintf(
                'No options instance set for the adapter "%s"',
                get_class($this)
            ));
        }
        return $this->options;
    }
1033566
public function destruir()
    {
        if (!$this->iniciado) {
            throw new \RuntimeException('La sesión no fue iniciada previamente.');
        }

        $this->adaptador->destruir($this->id);
        $this->iniciado = false;
    }
635843
public function getAdapter()
    {
        $className = $this->app->make('config')->get('antares/logger::adapter.default.model');
        return $this->app->make($className);
    }
704524
protected function getAdapter() {
        // Backwards compatability as I won't bump the version number for this
        // yet. When I add PHP 7 support I'll bump it and remove this.
        if (!$this->adapter) {
            $this->adapter = new Curl();
            $this->adapter->setLogger(new NullLogger());
        }
        return $this->adapter;
    }
860556
public function getAdapter()
    {
        if ($this->adapter instanceof Compress\CompressionAlgorithmInterface) {
            return $this->adapter;
        }

        $adapter = $this->adapter;
        $options = $this->getAdapterOptions();
        if (!class_exists($adapter)) {
            $adapter = 'Zend\\Filter\\Compress\\' . ucfirst($adapter);
            if (!class_exists($adapter)) {
                throw new Exception\RuntimeException(sprintf(
                    '%s unable to load adapter; class "%s" not found',
                    __METHOD__,
                    $this->adapter
                ));
            }
        }

        $this->adapter = new $adapter($options);
        if (!$this->adapter instanceof Compress\CompressionAlgorithmInterface) {
            throw new Exception\InvalidArgumentException("Compression adapter '" . $adapter . "' does not implement Zend\\Filter\\Compress\\CompressionAlgorithmInterface");
        }
        return $this->adapter;
    }
264847
public function run(): void
    {
        if (!$this->config->isLoadedFromFile()) {
            throw new \RuntimeException('No configuration to edit');
        }

        $this->checkHook();
        $this->checkChange();

        $change = $this->createChange();
        $change->applyTo($this->config);
        Config\Util::writeToDisk($this->config);

        $this->io->write('Configuration successfully updated');
    }
264596
public static function getAdapter(string $adapter = null): AbstractCacheAdapter
    {
        $key = $adapter ?? static::getConfig()->getFirstKey();

        if (isset(static::$adapters[$key])) {
            return static::$adapters[$key];
        }

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

        if (($configArray['enabled'] ?? false) === false) {
            static::$adapters[$key] = new Cache\Adapter\DevNull([]);
        } else {

            if (isset($configArray['module'])) {
                Application::registerModule($configArray['module']);
            }

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

            if ($className === null) {
                throw new ConfigException("Cache config under key={$key} doesn\'t have defined 'adapter_class'; please set the 'adapter_class' with the name of class that extends \\Koldy\\Cache\\Adapter\\AbstractCacheAdapter");
            }

            if (!class_exists($className, true)) {
                throw new ConfigException("Class={$className} defined in cache config under key={$adapter} wasn't found; check the name and namespace of class and if class can be loaded");
            }

            static::$adapters[$key] = new $className($configArray['options'] ?? []);
        }

        return static::$adapters[$key];
    }
42607
protected function _loadFeaturesAdapter()
    {
        $config      = $this->_config;
        $browserType = $this->getType();
        if (!isset($config[$browserType]) || !isset($config[$browserType]['features'])) {
            return array();
        }
        $config = $config[$browserType]['features'];

        if (empty($config['classname'])) {

            throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "classname" config parameter defined');
        }

        $className = $config['classname'];
        if (!class_exists($className)) {
            if (isset($config['path'])) {
                $path = $config['path'];
            } else {

                throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "path" config parameter defined');
            }

            if (false === include_once ($path)) {

                throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter path that does not exist');
            }
        }

        return call_user_func(array($className, 'getFromRequest'), $this->_server, $this->_config);
    }
931283
public function createEnvironment()
    {
        if (empty($this->containerName) && !$this->dataContainer) {
            throw new DcGeneralRuntimeException('Required container name or container is missing');
        }

        if (null === $this->eventDispatcher) {
            throw new DcGeneralRuntimeException('Required event dispatcher is missing');
        }

        if (null === $this->translator) {
            throw new DcGeneralRuntimeException('Required translator is missing');
        }

        if ($this->dataContainer) {
            $dataContainer = clone $this->dataContainer;
        } else {
            $dataContainer = $this->createContainer();
        }

        /** @var EnvironmentInterface $environment */
        $environment = (new \ReflectionClass($this->environmentClassName))->newInstance();
        $environment->setDataDefinition($dataContainer);
        $environment->setEventDispatcher($this->eventDispatcher);
        $environment->setTranslator($this->translator);

        // Backwards compatibility.
        $this->getEventDispatcher()->dispatch(
            PopulateEnvironmentEvent::NAME,
            new PopulateEnvironmentEvent($environment)
        );

        return $environment;
    }
41738
private function initialize()
    {
        $adapter = $this->getAdapter();
        if (($adapter instanceof AdapterInterface) === false) {
            throw new InvalidArgumentException(sprintf('No adapter found to handle VCS repository "%s".', $this->repositoryUrl));
        }

        $this->repositoryAdapter = $adapter;
    }
693728
public function getAdapter()
    {
        if (is_null($this->adapter) || ! $this->adapter instanceof AdapterInterface) {
            $class = '\\Wslim\\Db\Adapter\\' . $this->options['adapter'] . 'Adapter';
            if (!class_exists($class)) {
                throw new DbException('database adapter is not exists:' . $class);
            }
            
            $this->adapter  =   new $class($this->options);
        }
        
        return $this->adapter;
    }