Set the adapter.

@param (string) $adapter

@since 3.0.0

@return object
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__;
    }
635408
public function factory( $adapter, $options = null )
    {
        $adapter = parent::factory( $adapter, $options );
        $adapter->setModel( $this->getModel() );

        if ( $adapter instanceof ServiceLocatorAwareInterface )
        {
            $adapter->setServiceLocator( $this->getServiceLocator() );
        }

        return $adapter;
    }
1008989
public function addTarget($adapter)
    {
        $this->addDefinition(
            'targets',
            is_callable($adapter) ? new CallbackAdapter(null, $adapter) : $adapter
        );

        return $this;
    }
1037353
public function setAdapter($options = null)
    {
        if (is_string($options)) {
            $adapter = $options;
        } elseif (isset($options['adapter'])) {
            $adapter = $options['adapter'];
            unset($options['adapter']);
        } else {
            $adapter = 'BlockCipher';
        }

        if (!is_array($options)) {
            $options = [];
        }

        if (class_exists('Zend\Filter\Encrypt\\' . ucfirst($adapter))) {
            $adapter = 'Zend\Filter\Encrypt\\' . ucfirst($adapter);
        } elseif (!class_exists($adapter)) {
            throw new Exception\DomainException(
                sprintf(
                    '%s expects a valid registry class name; received "%s", which did not resolve',
                    __METHOD__,
                    $adapter
                )
            );
        }

        $this->adapter = new $adapter($options);
        if (!$this->adapter instanceof Encrypt\EncryptionAlgorithmInterface) {
            throw new Exception\InvalidArgumentException(
                "Encoding adapter '" . $adapter
                . "' does not implement Zend\\Filter\\Encrypt\\EncryptionAlgorithmInterface"
            );
        }

        return $this;
    }
1087862
public static function isEnabled(string $adapter): bool
    {
        $config = static::getConfig();

        if (!$config->has($adapter)) {
            return false;
        }

        $enabled = $config->getArrayItem($adapter, 'enabled');
        if ($enabled === null) {
            return false;
        }

        return (bool)$enabled;
    }
934918
public function plugAdapter(
        $adapter,
        array $adaptees,
        ModelInterface $model = null
    ) {
        return $this->plugger
            ->setModel($model ?: $this)
            ->setAdapter($adapter)
            ->plugIn($adaptees)
            ->getConnected();
    }
931108
public function getWriteConnection(AdapterInterface $adapter = null)
    {
        if (null === $this->writeConnection) {
            $this->writeConnection = ConnectionFactory::create($this->writeConfiguration, $adapter);
            $this->writeConnection->setName($this->getName());
        }

        return $this->writeConnection;
    }
251683
public static function encrypt($data, $adapter = null)
    {
        ($adapter !== null) ? self::setAdapter($adapter) : self::setAdapter(__config()->encryption->driver);

        return self::$adapter->encrypt($data);
    }
77694
public function setAdapter(AdapterInterface $v)
    {
        $this->db = $v;
        foreach ($this->clauses as $clause) {
            $clause->setAdapter($v);
        }
    }
1022968
public function setGetter($getter)
    {
        if (!is_bool($getter)) {
            throw new \InvalidArgumentException('The attribute getter on the class Attribute has to be boolean (' . gettype($getter) . ('object' === gettype($getter) ? ' ' . get_class($getter) : '') . ' given).');
        }

        $this->getter = $getter;

        return $this;
    }
553612
protected function registerAdapterInstance(AdapterInterface $adapter): string
	{
		$this->adapters[$name = $adapter->getName()] = $adapter;

		return $name;
	}
24293
private function createAdapterDefinition(array $adapter, $configuration)
    {
        $definition = new DefinitionDecorator(self::createServiceName('abstract'));
        $definition->setArguments([$adapter['type']]);
        $definition->addMethodCall('setConfiguration', [new Reference($configuration)]);

        return $definition;
    }
401734
static public function isAvailableAdapter($adapter)
    {
        $adapter = strtolower($adapter);
        $result  = false;
        $type    = null;

        $pdoAdapters = (class_exists('Pdo', false)) ? \PDO::getAvailableDrivers() : array();
        if (strpos($adapter, 'pdo_') !== false) {
            $type    = substr($adapter, 4);
            $adapter = 'pdo';
        }

        switch ($adapter) {
            case 'mysql':
            case 'mysqli':
                $result = (class_exists('mysqli', false));
                break;
            case 'oci':
            case 'oracle':
                $result = (function_exists('oci_connect'));
                break;
            case 'pdo':
                $result = (in_array($type, $pdoAdapters));
                break;
            case 'pgsql':
                $result = (function_exists('pg_connect'));
                break;
            case 'sqlite':
                $result = (class_exists('Sqlite3', false));
                break;
            case 'sqlsrv':
                $result = (function_exists('sqlsrv_connect'));
                break;
        }

        return $result;
    }
345816
public function registerAdapter(Adapter $adapter)
    {
        $adapter->setTranscoder($this);
        $this->adapters[$adapter->getKey()] = $adapter;

        return $this;
    }
530703
protected function _setAdapter(array $options)
    {
        $adapterFactory = AdapterFactory::instance();
        $connection     = new Connection($this->_connectionConfig->getArrayCopy());
        $adapter        = $adapterFactory->getAdapter($this->_adapterName, $options);

        return new CakeAdapter($adapter, $connection);
    }
784200
public function setAdapterAction($action)
    {
        if (true===$this->isInited) {
            $this->resetOutput();
        }
        $this->__adapter_action = $action;
        return $this;
    }
61740
public function setAdapterType($type)
    {
        $adapter_type = '\Library\Reporter\Adapter\\'.ucfirst($type);
        if (class_exists($adapter_type)) {
            $this->setAdapter(new $adapter_type);
        } else {
            throw new \RuntimeException(
                sprintf('Reporter adapter for type "%s" doesn\'t exist!', $adapter_type)
            );
        }
        return $this;
    }