Configura el handler

@param array $config Configuración.
+ [output] => directorio de salida. Defecto: /tmp
+ [fileName] => nombre del archivo del log. Defecto: log

@return AbstractHandler
188430
public function config(array $config = []):AbstractHandler
    {
        $config = $config + ['output' => '/tmp', 'fileName' => 'log'];
        $this->output = rtrim($config['output'], '/').'/'.$config['fileName'].static::LOG_EXT;
        $this->validateOutput();
        return $this;
    }
241125
protected function createStackDriver(array $config)
    {
        $handlers = [];

        foreach ($config['channels'] ?? [] as $channel) {
            $handlers = \array_merge($handlers, $this->channel($channel)->getHandlers());
        }

        return new Monolog($this->parseChannel($config), $handlers);
    }
808007
public function configure($config = [])
    {
        return new static ([
            'driver'   => 'pdo_sqlite',
            'user'     => array_get($config, 'username'),
            'password' => array_get($config, 'password'),
            'prefix'   => array_get($config, 'prefix'),
            'memory'   => $config['database'] == ':memory' ? true : false,
            'path'     => $config['database'] == ':memory' ? null : $config['database']
        ]);
    }
919093
protected function platformConnectHandler(Config $config)
    {
        $hostname = empty($config->hostname) ? 'localhost' : $config->hostname;
        $port = empty($config->port) ? 27071 : $config->port;
        $this->database = $config->database;

        $this->handle = new \MongoDb\Driver\Manager('mongoDb://' . $hostname . ':' . $port);
        $this->server = $this->handle->selectServer(new \MongoDb\Driver\ReadPreference(\MongoDb\Driver\ReadPreference::RP_PRIMARY));
    }
482162
protected function createDailyDriver(array $config)
    {
        return new Monolog($this->parseChannel($config), [
            $this->prepareHandler(new RotatingFileHandler(
                $config['path'], $config['days'] ?? 7, $this->level($config)
            )),
        ]);
    }
558733
protected function createLogDriver(array $config)
    {
        $logger = $this->app->make('Psr\Log\LoggerInterface');

        return new LogBroadcaster($this->app, $logger);
    }
547525
private function resolveConfig(array $config)
    {
        if (!isset($config['httpHandler'])) {
            $config['httpHandler'] = HttpHandlerFactory::build();
        }

        if (!isset($config['asyncHttpHandler'])) {
            $isGuzzleHandler = $config['httpHandler'] instanceof Guzzle6HttpHandler
                || $config['httpHandler'] instanceof Guzzle5HttpHandler;
            $config['asyncHttpHandler'] = $isGuzzleHandler
                ? [$config['httpHandler'], 'async']
                : [HttpHandlerFactory::build(), 'async'];
        }

        return array_merge($this->config, $config);
    }
545434
public function handle(Config $config)
    {
        $sampleOption = $this->option('sample');

        $type = 'empty';
        if( $sampleOption )
        {
            $type = 'sample';
        }

        $from = __DIR__ . '/../../resources/'.$type.'_schema.xml';
        $to = $config->get('propel.propel.paths.schemaDir') . '/' . $config->get('propel.propel.generator.schema.basename') . '.xml';

        if( ! copy($from, $to) )
        {
            throw new \Exception('Failed to copy a file "' . $from . '" to "' . $to . '"');
        }

        $content = file_get_contents($to);

        $name = $config->get('propel.propel.generator.defaultConnection');
        $content = str_replace('**NAME**', $name, $content);

        $nameSpace = $this->laravel->getNamespace() . str_replace(app_path().DIRECTORY_SEPARATOR, '', $config->get('propel.propel.paths.phpDir'));
        $content = str_replace('**NAMESPACE**', $nameSpace, $content);

        file_put_contents($to, $content);

        $this->comment(PHP_EOL . 'Create ' . $to . PHP_EOL);
    }
876534
public function setHandler(array $config)
    {
        $connect = $config['connect'] ?? [];

        switch (strtolower($config['handler'])) {
            case 'redis':
                $class = Handler\Redis::class;
                $conn = Redis::client($connect);
                break;

            case 'simple':
            case 'simplecache':
                $class = Handler\SimpleCache::class;
                $conn = Cache::simple($connect);
                break;

            case 'cache':
                $class = Handler\Cache::class;
                $conn = Cache::pool($connect);
                break;

            case 'db':
                $class = Handler\Database::class;
                $conn = Database::pdo($connect);
                break;

            default:
                return;
        }

        $settings = $config['settings'] ?? [];
        if (!isset($settings['lifetime']) && isset($this->cookieParams['lifetime'])) {
            $settings['lifetime'] = $this->cookieParams['lifetime'];
        }

        $this->handler = new $class($conn, $settings);
    }
469376
public function configure(array $config = []) {
        $this->_config = [
            'request_path' => filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING),
            'request_queries' => filter_input(INPUT_SERVER, 'QUERY_STRINGS', FILTER_SANITIZE_STRING),
            'request_controller' => FALSE,
            'request_action' => FALSE,
            'root_dir' => NULL,
            'default_controller' => 'index',
            'default_action' => 'index'
        ] + $config;
        
        if ( $this->_config['request_controller'] === FALSE || $this->_config['request_action'] === FALSE) {
            $url = explode('/', $this->_config['request_path']);
            $this->_config['request_controller'] = array_shift($url);
            $this->_config['request_action'] = array_shift($url);
        }
    }
44397
private function handleRepositoryConfig($config)
    {
        $count = 0;
        if (is_array($config) && array_key_exists('repositories', $config)) {
            foreach ($config['repositories'] as $repoName => $repoConf) {
                $repoConf = $this->configurator->resolveRepositoryConfig($repoConf);
                $repository = $this->addRepository($repoName, $repoConf['path'], $repoConf['options'], $repoConf['commands']);
                ++$count;

                // adding branches
                if (array_key_exists('branch', $repoConf)) {
                    foreach ($repoConf['branch'] as $branchName => $branchOptions) {
                        $branchOptions = $this->configurator->resolveBranchConfig($branchOptions);
                        $repository->addBranch($branchName, $branchOptions['commands'], $branchOptions['path'], $branchOptions['options']);
                    }
                }
            }
        }

        return $count;
    }
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);
    }
1133971
private function configure(array $config = [])
    {
        foreach ($config as $property => $value) {
            if (property_exists($this, $property)) {
                $this->{$property} = $value;
            }
        }
    }
1110482
public function load(array $config)
    {
        $config = $this->getParsedConfig(
            $config,
            $this->config,
            $this->yamlConfigMap,
            $this->required
        );
        $this->setParsedConfig($config);

        return $this;
    }
563283
protected function appendCommandsToConfig(array &$config)
    {
        collect($this->entityCommandHandlers)
            ->merge(collect($this->instanceCommandHandlers))
            ->each(function($handler, $commandName) use(&$config) {
                $formFields = $handler->form();
                $formLayout = $formFields ? $handler->formLayout() : null;
                $hasFormInitialData = $formFields
                    ? is_method_implemented_in_concrete_class($handler, 'initialData')
                    : false;

                $config["commands"][$handler->type()][$handler->groupIndex()][] = [
                    "key" => $commandName,
                    "label" => $handler->label(),
                    "description" => $handler->description(),
                    "type" => $handler->type(),
                    "confirmation" => $handler->confirmationText() ?: null,
                    "form" => $formFields ? [
                        "fields" => $formFields,
                        "layout" => $formLayout
                    ] : null,
                    "fetch_initial_data" => $hasFormInitialData,
                    "authorization" => $handler->getGlobalAuthorization()
                ];
            });
    }
90704
public function phpDoctor($config = 'default.ini')
    {

        // record start time
        $this->_startTime = $this->_getTime();

        // set the path
        $this->_path = dirname(dirname(__FILE__));

        // read config file
        if (is_file($config)) {
            $this->_options = @parse_ini_file($config);
            if (count($this->_options) == 0) {
                $this->error('Could not parse configuration file "'.$config.'"');
                exit;
            }
        } else {
            $this->error('Could not find configuration file "'.$config.'"');
            exit;
        }

        // set phpdoctor options
        if (isset($this->_options['verbose'])) {
            $this->_verbose = $this->_options['verbose'];
            $this->verbose('Being verbose');
        }
        if (isset($this->_options['quiet'])) $this->_quiet = $this->_options['quiet'];

        if (isset($this->_options['source_path'])) {
            $this->_sourcePath = array();
            foreach (explode(',', $this->_options['source_path']) as $path) {
                $this->_sourcePath[] = $this->fixPath($path, getcwd());
            }
        }

        if (isset($this->_options['subdirs'])) {
            $this->_subdirs = $this->_options['subdirs'];
        }

        if (isset($this->_options['files'])) {
            $files = explode(',', $this->_options['files']);
        } else {
            $files = array('*.php');
        }
        if (isset($this->_options['ignore'])) {
            $this->_ignore = explode(',', $this->_options['ignore']);
        }

        $this->verbose('Searching for files to parse...');
        $this->_files = array();
        foreach ($this->_sourcePath as $path) {
            $this->_files[$path] = array_unique($this->_buildFileList($files, $path));
        }
        if (count($this->_files) == 0) {
            $this->error('Could not find any files to parse');
            exit;
        }

        if (isset($this->_options['default_package'])) $this->_defaultPackage = $this->_options['default_package'];
        if (isset($this->_options['use_class_path_as_package'])) $this->_useClassPathAsPackage = $this->_options['use_class_path_as_package'];
        if (isset($this->_options['ignore_package_tags'])) $this->_ignorePackageTags = $this->_options['ignore_package_tags'];

    // use first path element
        if (isset($this->_options['overview'])) $this->_overview = $this->makeAbsolutePath($this->_options['overview'], $this->_sourcePath[0]);
        if (isset($this->_options['package_comment_dir'])) $this->_packageCommentDir = $this->makeAbsolutePath($this->_options['package_comment_dir'], $this->_sourcePath[0]);

        if (isset($this->_options['globals'])) $this->_globals = $this->_options['globals'];
        if (isset($this->_options['constants'])) $this->_constants = $this->_options['constants'];
        if (isset($this->_options['tree'])) $this->_tree = $this->_options['tree'];

        if (isset($this->_options['private']) && $this->_options['private']) {
            $this->_public = TRUE;
            $this->_protected = TRUE;
            $this->_private = TRUE;
        } elseif (isset($this->_options['protected']) && $this->_options['protected']) {
            $this->_public = TRUE;
            $this->_protected = TRUE;
            $this->_private = FALSE;
        } elseif (isset($this->_options['public']) && $this->_options['public']) {
            $this->_public = TRUE;
            $this->_protected = FALSE;
            $this->_private = FALSE;
        }

        if (isset($this->_options['doclet'])) $this->_doclet = $this->_options['doclet'];
        if (isset($this->_options['doclet_path'])) $this->_docletPath = $this->_options['doclet_path'];
        else $this->_docletPath = $this->_path.DIRECTORY_SEPARATOR.$this->_docletPath;
        if (isset($this->_options['taglet_path'])) $this->_tagletPath = $this->_options['taglet_path'];
        if (isset($this->_options['formatter'])) $this->_formatter = $this->_options['formatter'];
        if (isset($this->_options['formatter_path'])) $this->_formatterPath = $this->_options['formatter_path'];
        else $this->_formatterPath = $this->_path.DIRECTORY_SEPARATOR.$this->_formatterPath;

        if (isset($this->_options['pear_compat'])) $this->_pearCompat = $this->_options['pear_compat'];
    }
241461
private function buildClient(array $config)
    {
        $client = ClientBuilder::create()
            ->setHosts($config['hosts']);

        if (isset($config['retries'])) {
            $client->setRetries($config['retries']);
        }

        if (isset($config['logging']) and $config['logging']['enabled'] == true) {
            $logger = ClientBuilder::defaultLogger($config['logging']['path'], $config['logging']['level']);
            $client->setLogger($logger);
        }

        return $client->build();
    }