Gather the information to build an adapter.

@param string $alias The alias chosen for the adapter we want.

@throws \InvalidArgumentException Thrown when no matching configuration is found.

@return AdapterInterface
497694
protected static function create($alias)
    {
        $aliasConfigKey = static::CONFIGURE_KEY_PREFIX . $alias;
        if (!Configure::check($aliasConfigKey)) {
            throw new \InvalidArgumentException('Filesystem "' . $alias . '" not configured');
        }

        if (static::existsAndInstanceOf($aliasConfigKey)) {
            return Configure::read($aliasConfigKey . '.client');
        }

        if (Configure::check($aliasConfigKey . '.factory')) {
            return static::factory(Configure::read($aliasConfigKey . '.factory'));
        }

        if (self::existsAndVarsCount($aliasConfigKey)) {
            return static::adapter(static::read($aliasConfigKey, 'adapter'), static::read($aliasConfigKey, 'vars'));
        }

        if (self::existsWithDsn($aliasConfigKey)) {
            return static::adapterFromDsn(Configure::read($aliasConfigKey. '.url'));
        }

        throw new \InvalidArgumentException(sprintf(static::INVALID_ARGUMENT_MSG, $alias));
    }
34326
protected function getAdapter() : AdapterInterface
    {
        if ($this->adapter === null) {
            $databaseFile = $this->getTemporaryFileName();
            $adapter = AdapterFactory::getInstance($databaseFile);
            $this->setAdapter($adapter);
        }

        return $this->adapter;
    }
1314391
public function setAlias($alias) {
        if ($alias !== null && ! $this->argumentsParser->isOptionAlias($alias)) {
            throw new InvalidOptionAliasException(s(
                'A option alias must have this format: "-f", got: "%s"', $alias
            ));
        }

        $this->alias = $alias;

        return $this;
    }
1098343
public function load($alias)
    {
        if (isset($this->aliases[$alias])) {
            return class_alias($this->aliases[$alias], $alias);
        }
        return null;
    }
1154300
public function getAliasNamespace($alias)
    {
        foreach ($this->getManagerNames() as $name) {
            try {
                return $this->getManager($name)->getConfiguration()->getEntityNamespace($alias);
            } catch (ORMException $e) {
            }
        }

        throw ORMException::unknownEntityNamespace($alias);
    }
1115161
public static function retrieve($alias)
    {
        if (!isset(static::$instances[$alias])) {
            static::$instances[$alias] = static::addPlugins(new Filesystem(static::create($alias)));
        }

        return static::$instances[$alias];
    }
334443
public static function getAlias($alias)
    {
        return isset(self::$_aliases[$alias]) ? self::$_aliases[$alias] : null;
    }
562049
public function getFetcher($alias)
    {
        if (!is_string($alias)) {
            throw new UnexpectedTypeException($alias, 'string');
        }

        if (!isset($this->fetchers[$alias])) {
            throw new \InvalidArgumentException(sprintf('Could not load configuration fetcher "%s"', $alias));
        }

        return $this->fetchers[$alias];
    }
820929
public static function getAlias($alias)
    {
        $alias = strtolower($alias);

        return array_key_exists($alias, self::$aliases) ? self::$aliases[$alias] : false;
    }
562734
public function setAlias($alias)
    {
        /**
         * @T00D00
         */
        $this->alias = $alias;
        $this->getQuery()->alias($alias);

        return $this;
    }
1251608
public function get(string $alias = null)
    {
        if (is_null($alias)) {
            return $this->aliases;
        }

        return $this->has($alias) ? $this->aliases[$alias] : false;
    }
811262
public function getIndexer($index)
    {
        if (!isset($this->chain[$index])) {
            throw new \InvalidArgumentException(sprintf("Indexer for index '%s' is not registered", $index));
        }

        return $this->chain[$index];
    }
238008
public function alias(string $alias): AliasInterface
    {
        if (!in_array($alias, $this->alias)) {
            $this->alias[] = $alias;
        }
        $this->aliasHelper($alias);

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

		return $this->adapters[$name] ?? $this->adapterFactory($name);
	}
280616
public function setAdapter($adapter)
    {
        if ($adapter instanceof Compress\CompressionAlgorithmInterface) {
            $this->adapter = $adapter;
            return $this;
        }
        if (!is_string($adapter)) {
            throw new Exception\InvalidArgumentException('Invalid adapter provided; must be string or instance of Zend\\Filter\\Compress\\CompressionAlgorithmInterface');
        }
        $this->adapter = $adapter;

        return $this;
    }
528455
public function getIndicesWithAlias($alias)
    {
        $endpoint = new Get();
        $endpoint->setName($alias);

        $response = null;

        try {
            $response = $this->_client->requestEndpoint($endpoint);
        } catch (ResponseException $e) {
            // 404 means the index alias doesn't exist which means no indexes have it.
            if (404 === $e->getResponse()->getStatus()) {
                return [];
            }
            // If we don't have a 404 then this is still unexpected so rethrow the exception.
            throw $e;
        }
        $indices = [];
        foreach ($response->getData() as $name => $unused) {
            $indices[] = new Index($this->_client, $name);
        }

        return $indices;
    }
110103
public function getProvider($alias)
    {
        if (array_key_exists($alias, $this->providers)) {
            return $this->providers[$alias];
        }

        return null;
    }