Creates a ConfigurationInterface with passed arguments

@param string|array $fileName
@param null         $driverClass

@return ConfigurationInterface|PriorityConfigurationChain
353149
public static function get($fileName, $driverClass = null)
    {
        $configuration = new Configuration($fileName, $driverClass);
        return $configuration->initialize();
    }
703717
public function create(string $className, array $options)
    {
        $reflectionClass = $this->getReflectionClass($className);
        $options = Options::fromArray($options);

        $arguments = $this->resolveArguments($reflectionClass, $options);

        return new $className(...$arguments);
    }
115346
public static function create($classname, $args = null, $filter = null, $override = null) {
		//obtain provider list for this class
		$profile = Profiler::getClassProfile($classname);
		$providers = $profile->providers;
		
		if (empty($providers)) {
			throw new \RuntimeException("Class $classname does not have any provider associated with it");
		}

		//create new container and register all providers
		$container = new Container();
		
		foreach ($providers as $provider) {
			$providerInstance = self::getProvider($provider);
			$providerInstance->register($container);
		}

		return self::createWith($classname, $container, $args, $filter, $override);
	}
782386
public function createDriver($driver, array $config = [])
    {
        $driver = strtolower($driver);

        $queueConfig = new Structure($config);

        if (!$queueConfig->toArray()) {
            throw new \LogicException('No queue config for ' . $driver);
        }

        // TODO: All driver should have DI pattern.
        switch ($driver) {
            case 'sqs':
                return new SqsQueueDriver(
                    $queueConfig->get('key'),
                    $queueConfig->get('secret'),
                    $queueConfig->get('queue', 'default'),
                    [
                        'region' => $queueConfig->get('region', 'us-west-2'),
                        'version' => $queueConfig->get('version', 'latest'),
                    ]
                );

            case 'sync':
                return new SyncQueueDriver();

            case 'database':
                return new DatabaseQueueDriver(
                    $this->container->get('db'),
                    $queueConfig->get('queue', 'default'),
                    $queueConfig->get('table', 'queue_jobs')
                );

            case 'pdo':
                return new PdoQueueDriver(
                    $this->container->get('db')->getConnection(),
                    $queueConfig->get('queue', 'default'),
                    $queueConfig->get('table', 'queue_jobs')
                );

            case 'ironmq':
                return new IronmqQueueDriver(
                    $queueConfig->get('project_id'),
                    $queueConfig->get('token'),
                    $queueConfig->get('queue', 'default'),
                    [
                        'host' => $queueConfig->get('region', 'mq-aws-us-east-1-1') . '.iron.io',
                    ]
                );

            case 'rabbitmq':
                return new RabbitmqQueueDriver(
                    $queueConfig->get('queue', 'default'),
                    (array) $queueConfig->toArray()
                );

            case 'resque':
                return new ResqueQueueDriver(
                    $queueConfig->get('host', 'localhost'),
                    $queueConfig->get('port', '6379'),
                    $queueConfig->get('queue', 'default')
                );

            case 'beanstalkd':
                return new BeanstalkdQueueDriver(
                    $queueConfig->get('host', '127.0.0.1'),
                    $queueConfig->get('queue', 'default'),
                    $queueConfig->get('timeout', 60)
                );

            default:
                return new NullQueueDriver();
        }
    }
372608
public function setConfiguration(DriverInterface $driver)
    {
        $this->_configuration = $driver;
        $this->_namespace = null;
        $this->_action = null;
        $this->_controller = null;
        return $this;
    }
875702
public function createConnection(array $params, Configuration $config = null, EventManager $eventManager = null, array $mappingTypes = [])
    {
        if (! $this->initialized) {
            $this->initializeTypes();
        }

        $connection = DriverManager::getConnection($params, $config, $eventManager);

        if (! empty($mappingTypes)) {
            $platform = $this->getDatabasePlatform($connection);
            foreach ($mappingTypes as $dbType => $doctrineType) {
                $platform->registerDoctrineTypeMapping($dbType, $doctrineType);
            }
        }

        if (! empty($this->typesConfig)) {
            $this->markTypesCommented($this->getDatabasePlatform($connection));
        }

        return $connection;
    }
310841
public function store(string $fileName, $handle): ImageDriver
    {
        if (!@imagepng($handle, $fileName)) {
            throw new DriverException('Could not save image to ' . $fileName);
        }

        return $this;
    }
973839
public function create()
    {
        foreach ($this->driverClasses as $driverClass) {
            try {
                $driver = new $driverClass();

                return $driver;
            } catch (\Exception $e) {
            }
        }

        return null;
    }
8489
public static function create($conf = array(), LoggerInterface $logger = null)
    {
        if (!$conf instanceof ConfigurationInterface) {
            $conf = new Configuration($conf);
        }

        $binaries = $conf->get('mp4box.binaries', array('MP4Box'));

        return static::load($binaries, $logger, $conf);
    }
372141
public function getConfiguration($configurationId, $loadIntoDriver = false)
    {
        $dbConfiguration = IndexEngineDriverConfigurationQuery::create()->findPk($configurationId);

        if (null === $dbConfiguration) {
            throw new OutOfBoundsException(sprintf("The driver configuration id '%s' doesn't exist", $configurationId));
        }

        $driver = $this->driverRegistry->getDriver($dbConfiguration->getDriverCode());

        $configuration = $driver->getConfiguration();

        if (null !== $configuration) {
            $storedConfiguration = $dbConfiguration->getConfiguration();
            $configuration->loadValues($storedConfiguration);

            if (true === $loadIntoDriver) {
                $driver->loadConfiguration($configuration);
            }
        }

        return new DriverConfiguration($driver, $configuration);
    }
947180
private function setDriver($driver = null, $config = null)
    {
        $driver = $driver ?: ($this->driver ?: 'Local');
        $config = $config ?: ($this->driverConfig ?: 'Local');
        $class = strpos($driver, '\\') ? $driver : 'PHPCasts\\Uploads\\Driver\\' . ucfirst(strtolower($driver));
        $this->uploader = new $class($config);
        if (!$this->uploader) {
            throw new ConfigException('upload driver not exist!');
        }
    }
131661
protected function connectTo($connectionName)
    {
        $params = $this->getParams();

        $driverOptions = $params['driverOptions'] ?? [];

        $connectionParams = $this->chooseConnectionConfiguration($connectionName, $params);

        $user     = $connectionParams['user'] ?? null;
        $password = $connectionParams['password'] ?? null;

        return $this->_driver->connect($connectionParams, $user, $password, $driverOptions);
    }
593807
public function createConnection(): ConnectionInterface
    {
        $driver    = $this->poolConfig->getDriver();
        $collector = ConnectionCollector::getCollector();

        if (App::isCoContext()) {
            $connectClassName = $this->getCorConnectClassName($collector, $driver);
        } else {
            $connectClassName = $this->getSyncConnectClassName($collector, $driver);
        }

        return new $connectClassName($this);
    }
1161492
public static function build(string $connectionName = null) : Connection
    {
        $configs = Application::current()->config('database');
        $connectionName = $connectionName ?: $configs['default'];

        if (!isset($configs[$connectionName])) {
            throw new \Exception("Unknown database connection: '$connectionName'");
        }

        if (!isset(self::$connections[$connectionName])) {
            $connectionClass = $configs[$connectionName]['driver'];
            $options = $configs[$connectionName]['options'];
            self::$connections[$connectionName] = new $connectionClass($options);
        }

        return self::$connections[$connectionName];
    }
478500
public static function fromFile($filename)
	{
		$filename = realpath($filename);
		if ($filename === false)
			throw new ClientConfigurationException('Configuration file ' . $filename . ' does not exists');

		return static::fromArray(include $filename);
	}
1245198
public function create($className, $filePath)
    {
        $compiler = new CompilerFile($this->config, new AliasManager(), $this->filesystem);

        $compiler->setClassName($className);
        $compiler->setFilePath($filePath);
        $compiler->setLogger($this->logger);

        return $compiler;
    }
1140102
private function determineDriver($file)
    {
        $exception = new InvalidArgumentException(
            "Cannot initialize the configuration driver. I could not determine ".
            "the correct driver class."
        );

        if (is_null($file) || !is_string($file)) {
            throw $exception;
        }

        $nameDivision = explode('.', $file);
        $extension = strtolower(end($nameDivision));

        if (!array_key_exists($extension, $this->extensionToDriver)) {
            throw $exception;
        }

        return $this->extensionToDriver[$extension];
    }