Create an instance of the daily file log driver.

@param  array  $config
@return \Psr\Log\LoggerInterface
9527
protected function createDailyDriver(array $config)
    {
        return new Monolog($this->parseChannel($config), [
            $this->prepareHandler(new RotatingFileHandler(
                $config['path'], $config['days'] ?? 7, $this->level($config),
                $config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false
            ), $config),
        ]);
    }
476225
public function config(array $config)
    {
        parent::config($config);

        if (array_key_exists('fingerprint', $config)) {
            $this->defaults->setFingerprint($config['fingerprint']);
        }

        if (array_key_exists('path', $config)) {
            $this->defaults->setPath($config['path']);
        }

        if (array_key_exists('local_path', $config)) {
            $this->defaults->setLocalPath($config['local_path']);
        }

        if (array_key_exists('pattern', $config)) {
            $this->defaults->setPattern($config['pattern']);
        }

        if (array_key_exists('files_callback', $config)) {
            $this->defaults->setFilesCallback($config['files_callback']);
        }

        if (array_key_exists('do_cleanup', $config)) {
            $this->defaults->setDoCleanup($config['do_cleanup']);
        }

        return $this;
    }
565174
public static function create(array $config = [])
    {
        if (!isset($config['driver'])) {
            throw new InvalidArgumentException("'driver' in config missing");
        }
        if (!isset($config['drivers'][$config['driver']])) {
            throw new InvalidArgumentException("driver '{$config['driver']}' is not configured");
        }
        if (!isset($config['drivers'][$config['driver']]['tagHeaderName'])) {
            throw new InvalidArgumentException("'tagHeaderName' is not configured");
        }

        $driverConfig = $config['drivers'][$config['driver']];
        $driverClass = $driverConfig['class'] ?? self::DRIVERS_NAMESPACE . '\\' . ucfirst($config['driver']);

        // tagHeaderName and tagHeaderDelimiter are not relevant to the Purger
        unset($driverConfig['tagHeaderName'], $driverConfig['tagHeaderDelimiter']);
        return \Craft::createObject($driverClass,[$driverConfig + ['useLocalTags' => $config['useLocalTags']]]);

    }
619791
static public function factory($config = array()) {
        if (is_string($config)) {
            // Assume $config is a filename
            $filename = $config;
            $config = array(
                'timestampFormat' => 'Y-m-d',
                array(
                    'writerName' => 'Stream',
                    'writerParams' => array(
                        'stream' => self::_getLoggingDirectory() . DIRECTORY_SEPARATOR . $filename
                    )
                )
            );
        }
        return parent::factory($config);
    }
1050200
public function init($config = [])
    {
        $type  = isset($config['type']) ? $config['type'] : 'File';
        $class = false !== strpos($type, '\\') ? $type : '\\think\\log\\driver\\' . ucwords($type);

        $this->config = $config;

        unset($config['type']);

        if (class_exists($class)) {
            $this->driver = new $class($config);
        } else {
            throw new Exception('class not exists:' . $class, $class);
        }

        return $this;
    }
613778
protected function createSingleDriver(array $config)
    {
        return new Monolog($this->parseChannel($config), [
            $this->prepareHandler(
                new StreamHandler($config['path'], $this->level($config))
            ),
        ]);
    }
784003
public function createConnector(array $config)
    {
        if (! isset($config['driver'])) {
            throw new \InvalidArgumentException("A driver must be specified.");
        }

        if ($this->container->bound($key = "db.connector.{$config['driver']}")) {
            return $this->container->make($key);
        }

        switch ($config['driver'])
        {
            case 'mysql':
                return new MySqlConnector;

            case 'pgsql':
                return new PostgresConnector;

            case 'sqlite':
                return new SQLiteConnector;

            case 'sqlsrv':
                return new SqlServerConnector;
        }

        throw new \InvalidArgumentException("Unsupported driver [{$config['driver']}]");
    }
194801
protected function createSingleConnection($config)
    {
        $pdo = false;
        $connection = $this->createConnection($config['driver'], $pdo, $config['database'], $config['prefix'], $config);
        $connection->connect($config['host'], $config['username'], $config['password'], $config['database']);
        return $connection;
    }
1130191
public function createFileSystem(array $config)
    {

        $this->validateS3Config($config, $this->requiredAwsKeys);

        $client = S3Client::factory([
            FileUploadConstants::AWS_CREDENTIALS => [
                FileUploadConstants::KEY => $config[FileUploadConstants::AWS_KEY],
                FileUploadConstants::SECRET => $config[FileUploadConstants::AWS_SECRET],
            ],
            FileUploadConstants::REGION => $config[FileUploadConstants::AWS_REGION],
            FileUploadConstants::VERSION => FileUploadConstants::LATEST,
        ]);

        $adapter = new AwsS3Adapter(
            $client,
            $config[FileUploadConstants::BUCKET_NAME],
            isset($config[FileUploadConstants::BUCKET_PREFIX]) ? $config[FileUploadConstants::BUCKET_PREFIX] : null
        );

        $filesystem = new Filesystem($adapter);

        return $filesystem;
    }
855137
public static function create(array $config = [])
    {
        $container = new Container();

        foreach (self::$booleanSetters as $key => $method) {
            if (isset($config[$key])) {
                $container->$method((bool) $config[$key]);
            }
        }

        foreach (self::$arraySetters as $key => $method) {
            if (isset($config[$key]) && is_array($config[$key])) {
                foreach ($config[$key] as $name => $value) {
                    $container->$method($name, $value);
                }
            }
        }

        if (isset($config[Container::CONFIG_ENTRIES]) && is_array($config[Container::CONFIG_ENTRIES])) {
            self::createEntries($container, $config[Container::CONFIG_ENTRIES]);
        }

        return $container;
    }
759141
protected function createRedisDriver( array $config )
	{
		$redis = Framework::get( 'redis' );

		$connection = Arr::get( $config, 'connection', 'default' );

		return new RedisStore( $redis, $this->getPrefix( $config ), $connection );
	}
666623
public function create(array $config)
    {
        $broLibPath = dirname(dirname($config['binFilePath']));
        $preset = $config['preset'];

        $vendoredPath = $broLibPath . '/../../bro/code';

        $application = new Application();

        if (file_exists($vendoredPath)) {
            $broLibPath = $vendoredPath;
        }

        $broConfigPath = $broLibPath . '/presets/' . basename($preset) . '.php';
        $this->extendApplication($application, $broConfigPath);

        return $application;
    }
37118
public function newInstance(array $config)
    {
        $new_config = array_merge($this->default_config, $config);

        return new static($this->config_handler, $this->url, $new_config);
    }
358476
public static function instance($config = [])
    {
        if (null === self::$instance) {
            self::$instance = new static($config);
        }

        return self::$instance;
    }
639287
protected function createSyslogDriver(array $config)
    {
        return new Monolog(
            $this->parseChannel($config), [
            $this->prepareHandler(
                new SyslogHandler(
                    $this->app['config']['app.name'], $config['facility'] ?? LOG_USER, $this->level($config)
                )
            ),
            ]
        );
    }
1158155
protected function getClient(array $config)
    {
        $name = array_get($config, 'connector');

        return $this->cache->driver($name)->getStore();
    }
363248
public function createFromArray($config)
    {
        foreach ($config as $property => $value) {
            $this->{$property} = $value;
        }

        return $this;
    }