@param string $config

@return boolean|string
176671
private function processConfig($config)
    {
        $period = null;

        if ($config == 'mostviewed') {
            $period = $this->scopeConfig->getValue(
                self::XML_PATH_MOSTVIEWED_TIME_PERIOD
            );
        } elseif ($config == 'bestsellers') {
            $period = $this->scopeConfig->getValue(
                self::XML_PATH_BESTSELLER_TIME_PERIOD
            );
        } elseif ($config == 'recentlyviewed') {
            $period = $this->scopeConfig->getValue(
                self::XML_PATH_MOSTVIEWED_TIME_PERIOD
            );
        }
        return $period;
    }
1061631
public function getConfigItems($config) {
		$config = strtolower($config);
		return isset($this->config[$config]) ? $this->config[$config] : array();
	}
376788
protected function getHostDsn(array $config)
	{
		$dsn = "mysql:host=" . (isset($config["host"]) ? $config["host"] : "localhost") . ";";
		if( isset($config["port"]) ) $dsn .= "port=" . intval($config["port"]) . ";";
		if( isset($config["database"]) ) $dsn .= "dbname=" . $config["database"] . ";";
		return $dsn;
	}
130344
final protected function getConfigs($config = null)
    {
        if (null !== $config) {
            if (array_key_exists($config, self::$_configs)) {
                return self::$_configs[$config];
            } else {
                return false;
            }
        }

        return self::$_configs;
    }
47616
public function parseConfiguration($config)
    {
        if (is_string($config)) {
            $config = ['url' => $config];
        }

        $url = $config['url'] ?? null;

        $config = Arr::except($config, 'url');

        if (! $url) {
            return $config;
        }

        $parsedUrl = $this->parseUrl($url);

        return array_merge(
            $config,
            $this->getPrimaryOptions($parsedUrl),
            $this->getQueryOptions($parsedUrl)
        );
    }
1017491
protected function isValidData($config)
    {
        $valid = true;
        foreach ($config as $k => $v) {
            if (!($this->isValidKey($k) && $this->isValidValue($v))) {
                $valid = false;
                break;
            }
        }
        return $valid;
    }
91600
public function config($config = [])
    {
        $defaults = [
            'conventions' => [
                'source' => function($class) {
                    $basename = substr(strrchr($class, '\\'), 1);
                    return Inflector::underscore($basename);
                },
                'key' => function() {
                    return 'id';
                },
                'reference' => function($class) {
                    $pos = strrpos($class, '\\');
                    $basename = substr($class, $pos !== false ? $pos + 1 : 0);
                    return Inflector::underscore(Inflector::singularize($basename)). '_id';
                },
                'references' => function($class) {
                    $pos = strrpos($class, '\\');
                    $basename = substr($class, $pos !== false ? $pos + 1 : 0);
                    return Inflector::underscore(Inflector::singularize($basename)). '_ids';
                },
                'field' => function($class) {
                    $pos = strrpos($class, '\\');
                    $basename = substr($class, $pos !== false ? $pos + 1 : 0);
                    return Inflector::underscore(Inflector::singularize($basename));
                },
                'multiple' => function($name) {
                    return Inflector::pluralize($name);
                },
                'single' => function($name) {
                    return Inflector::singularize($name);
                }
            ]
        ];
        $config = Set::extend($defaults, $config);
        $this->_conventions = $config['conventions'];
    }
1097158
public function getOptions(array $config)
    {
        $options = array_get($config, 'options', array());

        return array_diff_key($this->options, $options) + $options;
    }
47208
public static function getInstance($Config)
    {
        if (!self::$Instance) {
            self::$Instance = CacheFactory::factory($Config);
        }
        return self::$Instance;
    }
1306412
protected function getDsn(array $config)
    {
        return $this->configHasSocket($config) ? $this->getSocketDsn($config) : $this->getHostDsn($config);
    }
856606
public function load(Config $config)
    {
        if (null === $config) {
            $config = new Config();
        }

        $this->loadExtensions($config);

        return $this
            ->applyCommands($config)
            ->applyHooks($config)
        ;
    }
1276425
private function getPrefix(Config $config)
    {
        $parts = explode(':', $config->getPrefix());
        array_shift($parts);

        return strtolower(str_replace(array('/', '\\'), '_', implode('_', $parts)));
    }
193351
public static function getInstance(Configuration $config = null)
    {
        if (!self::$instance) {
            self::$instance = new self($config);
        }

        return self::$instance;
    }
194327
protected static function parseConfig($config, $default)
    {
        array_walk($default, function ($value, $key) use (&$config) {
            if (empty($config[$key]) || !isset($config[$key])) {
                $config[$key] = $value;
            }
        });

        return $config;
    }
1234771
public function doConnect($config)
    {
        $connectionString = 'sqlite:' . $config['database'];
        return $this->container->build(
            '\PDO',
            array($connectionString, null, null, $config['options'])
        );
    }
622152
function getConfig( $config ) {
    switch( strtoupper( $config )) {
      case 'ALLOWEMPTY':
        return $this->allowEmpty;
        break;
      case 'COMPSINFO':
        unset( $this->compix );
        $info = array();
        foreach( $this->components as $cix => $component ) {
          unset( $component->propix );
          $info[$cix]['ordno'] = $cix + 1;
          $info[$cix]['type']  = $component->objName;
          $info[$cix]['uid']   = $component->getProperty( 'uid' );
          $info[$cix]['props'] = $component->getConfig( 'propinfo' );
          $info[$cix]['sub']   = $component->getConfig( 'compsinfo' );
          unset( $component->propix );
        }
        return $info;
        break;
      case 'DELIMITER':
        return $this->delimiter;
        break;
      case 'DIRECTORY':
        if( empty( $this->directory ))
          $this->directory = '.';
        return $this->directory;
        break;
      case 'DIRFILE':
        return $this->getConfig( 'directory' ).$this->getConfig( 'delimiter' ).$this->getConfig( 'filename' );
        break;
      case 'FILEINFO':
        return array( $this->getConfig( 'directory' )
                    , $this->getConfig( 'filename' )
                    , $this->getConfig( 'filesize' ));
        break;
      case 'FILENAME':
        if( empty( $this->filename )) {
          if( 'xcal' == $this->format )
            $this->filename = date( 'YmdHis' ).'.xml'; // recommended xcs.. .
          else
            $this->filename = date( 'YmdHis' ).'.ics';
        }
        return $this->filename;
        break;
      case 'FILESIZE':
        $size    = 0;
        if( empty( $this->url )) {
          $dirfile = $this->getConfig( 'dirfile' );
          if( FALSE === ( $size = filesize( $dirfile )))
            $size = 0;
          clearstatcache();
        }
        return $size;
        break;
      case 'FORMAT':
        return $this->format;
        break;
      case 'LANGUAGE':
         /* get language for calendar component as defined in [RFC 1766] */
        return $this->language;
        break;
      case 'NL':
      case 'NEWLINECHAR':
        return $this->nl;
        break;
      case 'UNIQUE_ID':
        return $this->unique_id;
        break;
      case 'URL':
        if( !empty( $this->url ))
          return $this->url;
        else
          return FALSE;
        break;
    }
  }
609371
protected function getopt($config = array()) {
        $this->config = $config;

        $opts = getopt("ac:dD:h:Hl:o:p:P:u:v::w:r:x:Z");

        if (isset($opts["H"])) {
            $this->show_help();
        }

        if (isset($opts["c"])) {
            $this->config['file'] = $opts['c'];
        }

        if (isset($this->config['file'])) {
            if (file_exists($this->config['file'])) {
                $this->parse_config($this->config['file']);
            }
            else {
                $this->show_help("Config file {$this->config['file']} not found.");
            }
        }

        /**
         * command line opts always override config file
         */
        if (isset($opts['P'])) {
            $this->config['pid_file'] = $opts['P'];
        }

        if (isset($opts["l"])) {
            $this->config['log_file'] = $opts["l"];
        }

        if (isset($opts['a'])) {
            $this->config['auto_update'] = 1;
        }

        if (isset($opts['w'])) {
            $this->config['worker_dir'] = $opts['w'];
        }

        if (isset($opts['x'])) {
            $this->config['max_worker_lifetime'] = (int)$opts['x'];
        }

        if (isset($opts['r'])) {
            $this->config['max_runs_per_worker'] = (int)$opts['r'];
        }

        if (isset($opts['D'])) {
            $this->config['count'] = (int)$opts['D'];
        }

        if (isset($opts['t'])) {
            $this->config['timeout'] = $opts['t'];
        }

        if (isset($opts['h'])) {
            $this->config['host'] = $opts['h'];
        }

        if (isset($opts['p'])) {
            $this->prefix = $opts['p'];
        } elseif (!empty($this->config['prefix'])) {
            $this->prefix = $this->config['prefix'];
        }

        if (isset($opts['u'])) {
            $this->user = $opts['u'];
        } elseif (isset($this->config["user"])) {
            $this->user = $this->config["user"];
        }

        /**
         * If we want to daemonize, fork here and exit
         */
        if (isset($opts["d"]) || (isset($this->config['daemon']) && $this->config['daemon'])) {
            $pid = pcntl_fork();
            if ($pid>0) {
                $this->isparent = false;
                exit();
            }
            $this->pid = getmypid();
            posix_setsid();
        }

        if (!empty($this->config['pid_file'])) {
            $fp = @fopen($this->config['pid_file'], "w");
            if ($fp) {
                fwrite($fp, $this->pid);
                fclose($fp);
            } else {
                $this->show_help("Unable to write PID to {$this->config['pid_file']}");
            }
            $this->pid_file = $this->config['pid_file'];
        }

        if (!empty($this->config['log_file'])) {
            if ($this->config['log_file'] === 'syslog') {
                $this->log_syslog = true;
            } else {
                $this->log_file = $this->config['log_file'];
                $this->open_log_file();
            }
        }

        if (isset($opts["v"])) {
            $this->config['verbose'] = $opts["v"];
        }

        if (isset($this->config['verbose'])) {
            switch ($this->config['verbose']) {
                case false:
                case GearmanManager::LOG_LEVEL_INFO:
                    $this->verbose = GearmanManager::LOG_LEVEL_INFO;
                    break;
                case "v":
                case GearmanManager::LOG_LEVEL_PROC_INFO:
                    $this->verbose = GearmanManager::LOG_LEVEL_PROC_INFO;
                    break;
                case "vv":
                case GearmanManager::LOG_LEVEL_WORKER_INFO:
                    $this->verbose = GearmanManager::LOG_LEVEL_WORKER_INFO;
                    break;
                case "vvv":
                case GearmanManager::LOG_LEVEL_DEBUG:
                    $this->verbose = GearmanManager::LOG_LEVEL_DEBUG;
                    break;
                case "vvvv":
                case GearmanManager::LOG_LEVEL_CRAZY:
                default:
                    $this->verbose = GearmanManager::LOG_LEVEL_CRAZY;
                    break;
            }
        }

        if ($this->user) {
            $user = posix_getpwnam($this->user);
            if (!$user || !isset($user['uid'])) {
                $this->show_help("User ({$this->user}) not found.");
            }

            /**
             * Ensure new uid can read/write pid and log files
             */
            if (!empty($this->pid_file)) {
                if (!chown($this->pid_file, $user['uid'])) {
                    $this->log("Unable to chown PID file to {$this->user}", GearmanManager::LOG_LEVEL_PROC_INFO);
                }
            }
            if (!empty($this->log_file_handle)) {
                if (!chown($this->log_file, $user['uid'])) {
                    $this->log("Unable to chown log file to {$this->user}", GearmanManager::LOG_LEVEL_PROC_INFO);
                }
            }

            posix_setuid($user['uid']);
            if (posix_geteuid() != $user['uid']) {
                $this->show_help("Unable to change user to {$this->user} (UID: {$user['uid']}).");
            }
            $this->log("User set to {$this->user}", GearmanManager::LOG_LEVEL_PROC_INFO);
        }

        if (!empty($this->config['auto_update'])) {
            $this->check_code = true;
        }

        if (!empty($this->config['worker_dir'])) {
            $this->worker_dir = $this->config['worker_dir'];
        } else {
            $this->worker_dir = "./workers";
        }

        $dirs = is_array($this->worker_dir) ? $this->worker_dir : explode(",", $this->worker_dir);
        foreach ($dirs as &$dir) {
            $dir = trim($dir);
            if (!file_exists($dir)) {
                $this->show_help("Worker dir ".$dir." not found");
            }
        }
        unset($dir);

        if (isset($this->config['max_worker_lifetime']) && (int)$this->config['max_worker_lifetime'] > 0) {
            $this->max_run_time = (int)$this->config['max_worker_lifetime'];
        }

        if (isset($this->config['worker_restart_splay']) && (int)$this->config['worker_restart_splay'] > 0) {
            $this->worker_restart_splay = (int)$this->config['worker_restart_splay'];
        }

        if (isset($this->config['count']) && (int)$this->config['count'] > 0) {
            $this->do_all_count = (int)$this->config['count'];
        }

        if (!empty($this->config['host'])) {
            if (!is_array($this->config['host'])) {
                $this->servers = explode(",", $this->config['host']);
            } else {
                $this->servers = $this->config['host'];
            }
        } else {
            $this->servers = array("127.0.0.1");
        }

        if (!empty($this->config['include']) && $this->config['include'] != "*") {
            $this->config['include'] = explode(",", $this->config['include']);
        } else {
            $this->config['include'] = array();
        }

        if (!empty($this->config['exclude'])) {
            $this->config['exclude'] = explode(",", $this->config['exclude']);
        } else {
            $this->config['exclude'] = array();
        }

        if (empty($this->config['worker_initial_spawn_splay']) || ! is_numeric($this->config['worker_initial_spawn_splay'])) {
            /**
             * Don't start workers too fast. They can overwhelm the
             * gearmand server and lead to connection timeouts.
             */
            $this->config['worker_initial_spawn_splay'] = 500000;
        }

        /**
         * Debug option to dump the config and exit
         */
        if (isset($opts["Z"])) {
            print_r($this->config);
            exit();
        }

    }