Creates an `Imagine` object based on the specified [[driver]].
@return ImagineInterface the new `Imagine` object
@throws InvalidConfigException if [[driver]] is unknown or the system doesn't support any [[driver]].
497292
protected static function createImagine()
    {
        foreach ((array) static::$driver as $driver) {
            switch ($driver) {
                case self::DRIVER_GMAGICK:
                    if (class_exists('Gmagick', false)) {
                        return new \Imagine\Gmagick\Imagine();
                    }
                    break;
                case self::DRIVER_IMAGICK:
                    if (class_exists('Imagick', false)) {
                        return new \Imagine\Imagick\Imagine();
                    }
                    break;
                case self::DRIVER_GD2:
                    if (function_exists('gd_info')) {
                        return new \Imagine\Gd\Imagine();
                    }
                    break;
                default:
                    throw new InvalidConfigException("Unknown driver: $driver");
            }
        }
        throw new InvalidConfigException("Your system does not support any of these drivers: " . implode(',', (array) static::$driver));
    }
701581
private function createConfigurationDriver()
    {
        $reflection = new \ReflectionClass($this->driverClass());

        /** @var ConfigurationInterface $config */
        $config = $reflection->hasMethod('__construct')
            ? $reflection->newInstanceArgs([$this->file])
            : $reflection->newInstance();
        return $config;
    }
710127
protected function createDriver($driverName)
    {
        [$driver, $name] = $this->getDriverName($driverName);

        $method = 'create'.Str::studly($driver).'Driver';

        // We'll check to see if a creator method exists for the given driver.
        // If not we will check for a custom driver creator, which allows
        // developers to create drivers using their own customized driver
        // creator Closure to create it.
        if (isset($this->customCreators[$driver])) {
            return $this->callCustomCreator($driverName);
        } elseif (\method_exists($this, $method)) {
            return $this->{$method}($name);
        }

        throw new InvalidArgumentException("Driver [$driver] not supported.");
    }
253048
private static function createDriver()
    {
        if (self::$factory === null) {
            throw new \Exception("No loop driver factory set; Either pass a driver to Loop::execute or set a factory.");
        }

        $driver = self::$factory->create();

        if (!$driver instanceof Driver) {
            $type = is_object($driver) ? "an instance of " . get_class($driver) : gettype($driver);
            throw new \Exception("Loop driver factory returned {$type}, but must return an instance of Driver.");
        }

        return $driver;
    }
1358784
public function initialize()
    {
        $driver = $this->_class;

        if (empty($driver)) {
            throw new Exception\InvalidArgumentException(
                "The session driver is invalid."
            );
        }

        // Load user defined driver
        if (class_exists($driver)) {
            $driverObj = new $driver($this->_options);
            if (is_a($driverObj, '\Slick\Session\Driver\DriverInterface')) {
                return $driverObj;
            } else {
                throw new Exception\InvalidArgumentException(
                    "The session type '{$driver}' doesn't inherited from "
                    ."Slick\Session\Driver\DriverInterface."
                );
            }
        }

        // Load module predefined drivers
        switch ($driver) {
            case 'server':
                $driverObj = new Driver\Server($this->_options);
                break;

            default:
                throw new Exception\InvalidArgumentException(
                    "The session type '{$driver}' isn't implemented."
                );
        }
       
        return $driverObj;
    }
838180
public function createDriver() : Driver
    {
        $classname = '\ntentan\atiaa\drivers\\'.Text::ucamelize($this->config['driver']).'Driver';

        return new $classname($this->config);
    }
693966
public function open()
    {
        if ($this->pdo !== null) {
            return;
        }

        if (!empty($this->masters)) {
            $db = $this->getMaster();
            if ($db !== null) {
                $this->pdo = $db->pdo;
                return;
            }

            throw new InvalidConfigException('None of the master DB servers is available.');
        }

        if (empty($this->dsn)) {
            throw new InvalidConfigException('Connection::dsn cannot be empty.');
        }

        $token = 'Opening DB connection: ' . $this->dsn;
        $enableProfiling = $this->enableProfiling;
        try {
            /*Zilf::info($token, __METHOD__);
            if ($enableProfiling) {
                Zilf::beginProfile($token, __METHOD__);
            }*/

            $this->pdo = $this->createPdoInstance();
            $this->initConnection();

            /* if ($enableProfiling) {
                 Zilf::endProfile($token, __METHOD__);
             }*/
        } catch (\PDOException $e) {
            /* if ($enableProfiling) {
                 Zilf::endProfile($token, __METHOD__);
             }*/

            throw new Exception($e->getMessage(), $e->errorInfo, (int)$e->getCode(), $e);
        }
    }
1310624
public function driver( $driver )
	{
		$driver = CCCORE_NAMESPACE.'\\'.'CCConfig_'.ucfirst( $driver );
		
		if ( !class_exists( $driver ) ) 
		{
			throw new \InvalidArgumentException("CCConfig - Invalid driver '".$driver."'");
		}
		
		$this->_driver = new $driver;
	}
1284658
public function getImagine()
    {
        if (!$this->imagine) {
            $this->imagine = $this->getServiceLocator()->get('HtImg\Imagine');
        }

        return $this->imagine;
    }
380369
protected function getImagine($driver = null)
    {
        if (null === $driver) {
            switch (true) {
                case function_exists('gd_info'):
                    $driver = 'gd';
                    break;
                case class_exists('Gmagick'):
                    $driver = 'gmagick';
                    break;
                case class_exists('Imagick'):
                    $driver = 'imagick';
                    break;
            }
        }

        if (!in_array($driver, array('gd', 'gmagick', 'imagick'))) {
            throw new \RuntimeException(sprintf('Driver "%s" does not exist.', $driver));
        }

        switch (strtolower($driver)) {
            case 'gd':
                return new Gd\Imagine();
            case 'gmagick':
                return new Gmagick\Imagine();
            case 'imagick':
                return new Imagick\Imagine();
        }
    }
1209373
public function chosen() : ?Connection
    {
        if ($this->filename === null) {
            return null;
        }

        if (! file_exists($this->filename)) {
            return null;
        }

        $params = include $this->filename;

        if (! is_array($params)) {
            throw InvalidConfiguration::invalidArrayConfiguration();
        }

        return DriverManager::getConnection($params);
    }
1204342
public function create()
    {
        /**
         * @var ConfigurationInterface $configuration
         */
        $classNamespace = $this->getEntityNamespace();
        $configuration = new $classNamespace();

        $configuration
            ->setNamespace('')
            ->setType(ElcodiConfigurationTypes::TYPE_STRING)
            ->setCreatedAt($this->now());

        return $configuration;
    }
413211
public function driver(?string $driver = null): self
    {
        $driver = $driver ? $driver : $this->app->make('config')->get('microservice-client.client');

        $connections = array_keys($this->app->make('config')->get('microservice-client.clients'));
        if (! in_array($driver, $connections, true)) {
            throw new DomainException("The Driver[{$driver}] not exists");
        }

        $this->driver = $driver;

        return $this;
    }
495758
static function getInstance()
    {
        $driver = static::getLibrary();

        try {
            $instance = new $driver();
        } catch (\Exception $e) {
            throw new Exception('Unable to create an instance of ' . $driver);
        }

        if (!self::isInstanceOf($instance, CryptInterface::class)) {
            throw new Exception(Exception::MSG_INVALID_ARG, ['driver', CryptInterface::class]);
        }

        return $instance;
    }
840387
public function make($driver, array $config = [])
    {
        switch ($driver) {
            case '/dev/null':
                return new DevNullPubSubAdapter();
            case 'local':
                return new LocalPubSubAdapter();
            case 'redis':
                return $this->makeRedisAdapter($config);
            case 'kafka':
                return $this->makeKafkaAdapter($config);
            case 'gcloud':
                return $this->makeGoogleCloudAdapter($config);
            case 'http':
                return $this->makeHTTPAdapter($config);
        }

        throw new InvalidArgumentException(sprintf('The driver [%s] is not supported.', $driver));
    }
1173061
public function makeModel()
    {
        if (!($this->model = $this->app->make($this->takeModel())) instanceof Eloquent) {
            throw new InvalidRepositoryModel(get_class($this->model), Eloquent::class);
        }

        return $this->model;
    }
217352
public function create()
    {
        if (empty($this->id)) {
            throw new InvalidException('You should set a valid pipeline id');
        }

        if (empty($this->_params['description'])) {
            throw new InvalidException('You should set a valid processor description.');
        }

        if (empty($this->_processors['processors'])) {
            throw new InvalidException('You should set a valid processor of type Elastica\Processor\AbstractProcessor.');
        }

        $endpoint = new Put();
        $endpoint->setID($this->id);
        $endpoint->setBody($this->toArray());

        return $this->requestEndpoint($endpoint);
    }