Get a read / write level configuration.

@param  array $config
@param  string $type
@return array
505641
protected function getReadWriteConfig( array $config, $type )
	{
		if ( isset( $config[$type][0] ) )
			return $config[$type][array_rand( $config[$type] )];

		return $config[$type];
	}
2056
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 'FORMAT':
        return $this->format;
        break;
      case 'LANGUAGE':
         // get language for calendar component as defined in [RFC 1766]
        return $this->language;
        break;
      case 'NL':
        return $this->nl;
        break;
      case 'PROPINFO':
        $output = array();
        if( 0 < count( $this->action ))
          $output['ACTION'] = count( $this->action ) / 2;
        if( 0 < count( $this->attach ))
          $output['ATTACH'] = count( $this->attach );
        if( 0 < count( $this->attendee ))
          $output['ATTENDEE'] = count( $this->attendee );
        if( 0 < count( $this->categories ))
          $output['CATEGORIES'] = count( $this->categories );
        if( 0 < count( $this->class ))
          $output['CLASS'] = count( $this->class ) / 2;
        if( 0 < count( $this->comment ))
          $output['COMMENT'] = count( $this->comment );
        if( 0 < count( $this->completed ))
          $output['COMPLETED'] = count( $this->completed ) / 2;
        if( 0 < count( $this->contact ))
          $output['CONTACT'] = count( $this->contact );
        if( 0 < count( $this->created ))
          $output['CREATED'] = count( $this->created ) / 2;
        if( 0 < count( $this->description ))
          $output['DESCRIPTION'] = count( $this->description );
        if( 0 < count( $this->dtend ))
          $output['DTEND'] = count( $this->dtend ) / 2;
        if( 0 < count( $this->dtstart ))
          $output['DTSTART'] = count( $this->dtstart ) / 2;
        if( 0 < count( $this->dtstamp ))
          $output['DTSTAMP'] = count( $this->dtstamp ) / 2;
        if( 0 < count( $this->due ))
          $output['DUE'] = count( $this->due ) / 2;
        if( 0 < count( $this->duration ))
          $output['DURATION'] = count( $this->duration ) / 2;
        if( 0 < count( $this->exdate ))
          $output['EXDATE'] = count( $this->exdate );
        if( 0 < count( $this->exrule ))
          $output['EXRULE'] = count( $this->exrule );
        if( 0 < count( $this->freebusy ))
          $output['FREEBUSY'] = count( $this->freebusy );
        if( 0 < count( $this->geo ))
          $output['GEO'] = count( $this->geo ) / 2;
        if( 0 < count( $this->lastmodified ))
          $output['LAST-MODIFIED'] = count( $this->lastmodified ) / 2;
        if( 0 < count( $this->location ))
          $output['LOCATION'] = count( $this->location ) / 2;
        if( 0 < count( $this->organizer ))
          $output['ORGANIZER'] = count( $this->organizer ) / 2;
        if( 0 < count( $this->percentcomplete ))
          $output['PERCENT-COMPLETE'] = count( $this->percentcomplete ) / 2;
        if( 0 < count( $this->priority ))
          $output['PRIORITY'] = count( $this->priority ) / 2;
        if( 0 < count( $this->rdate ))
          $output['RDATE'] = count( $this->rdate );
        if( 0 < count( $this->recurrenceid ))
          $output['RECURRENCE-ID'] = count( $this->recurrenceid ) / 2;
        if( 0 < count( $this->relatedto ))
          $output['RELATED-TO'] = count( $this->relatedto );
        if( 0 < count( $this->repeat ))
          $output['REPEAT'] = count( $this->repeat ) / 2;
        if( 0 < count( $this->requeststatus ))
          $output['REQUEST-STATUS'] = count( $this->requeststatus );
        if( 0 < count( $this->resources ))
          $output['RESOURCES'] = count( $this->resources );
        if( 0 < count( $this->sequence ))
          $output['SEQUENCE'] = count( $this->sequence ) / 2;
        if( 0 < count( $this->rrule ))
          $output['RRULE'] = count( $this->rrule );
        if( 0 < count( $this->status ))
          $output['STATUS'] = count( $this->status ) / 2;
        if( 0 < count( $this->summary ))
          $output['SUMMARY'] = count( $this->summary ) / 2;
        if( 0 < count( $this->transp ))
          $output['TRANSP'] = count( $this->transp ) / 2;
        if( 0 < count( $this->trigger ))
          $output['TRIGGER'] = count( $this->trigger ) / 2;
        if( 0 < count( $this->tzid ))
          $output['TZID'] = count( $this->tzid ) / 2;
        if( 0 < count( $this->tzname ))
          $output['TZNAME'] = count( $this->tzname );
        if( 0 < count( $this->tzoffsetfrom ))
          $output['TZOFFSETTFROM'] = count( $this->tzoffsetfrom ) / 2;
        if( 0 < count( $this->tzoffsetto ))
          $output['TZOFFSETTO'] = count( $this->tzoffsetto ) / 2;
        if( 0 < count( $this->tzurl ))
          $output['TZURL'] = count( $this->tzurl ) / 2;
        if( !in_array( $this->objName, array( 'valarm', 'vtimezone' ))) {
          if( empty( $this->uid['value'] ))
            $this->_makeuid();
          $output['UID'] = 1;
        }
        if( 0 < count( $this->url ))
          $output['URL'] = count( $this->url ) / 2;
        if( 0 < count( $this->xprop ))
          $output['X-PROP'] = count( $this->xprop );
        return $output;
        break;
      case 'UNIQUE_ID':
        if( empty( $this->unique_id ))
          $this->unique_id  = gethostbyname( $_SERVER['SERVER_NAME'] );
        return $this->unique_id;
        break;
    }
  }
805199
private function buildFallbackConfig(string $type, array $config): array
    {
        $type           = substr($type, 3);
        $fallbackConfig = $this->environment->getConfig()->get('form.layouts.' . $type, []);
        $fallbackConfig = ArrayUtil::merge($this->fallbackConfig, $fallbackConfig);

        foreach ($this->sections as $section) {
            $name = 'fallback' . ucfirst($section);

            if ($config[$name]) {
                $fallbackConfig['templates'][$section] = $config[$name];
            }
        }

        return $fallbackConfig;
    }
1324108
protected function getValues( array $config )
	{
		$values = array(
			'absoluteUri' => false,
		);

		if( isset( $config['absoluteUri'] ) ) {
			$values['absoluteUri'] = (bool) $config['absoluteUri'];
		}

		return $values;
	}
381098
protected function createReadPdo(array $config)
    {
        $readConfig = $this->getReadConfig($config);

        return $this->createConnector($readConfig)->connect($readConfig);
    }
751413
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = new Configuration($this->getMainConfigParser(), $this->suggestionCollector);
        $configuration->setSiteAccessConfigurationFilters($this->siteaccessConfigurationFilters);

        return $configuration;
    }
772159
public static function get(string $type): AbstractWriter
    {
        if (!\array_key_exists($type, static::$invokableClasses)) {
            throw new InvalidArgumentException('Unsupported config file type: '.$type);
        }

        return new static::$invokableClasses[$type];
    }
82372
public static function mergeConfig($key, $config)
    {
        $values = Hash::merge((array) Configure::read($key), $config);
        Configure::write($key, $values);

        return $values;
    }
714876
public static function getManifestFile(array $config, string $type = 'modern')
    {
        $manifest = null;
        // Determine whether we should use the devServer for HMR or not
        $devMode = Craft::$app->getConfig()->getGeneral()->devMode;
        self::$isHot = ($devMode && $config['useDevServer']);
        // Try to get the manifest
        while ($manifest === null) {
            $manifestPath = self::$isHot
                ? $config['devServer']['manifestPath']
                : $config['server']['manifestPath'];
            // Normalize the path
            $path = self::combinePaths($manifestPath, $config['manifest'][$type]);
            $manifest = self::getJsonFile($path);
            // If the manifest isn't found, and it was hot, fall back on non-hot
            if ($manifest === null) {
                // We couldn't find a manifest; throw an error
                self::reportError(Craft::t(
                    'twigpack',
                    'Manifest file not found at: {manifestPath}',
                    ['manifestPath' => $manifestPath]
                ), true);
                if (self::$isHot) {
                    // Try again, but not with home module replacement
                    self::$isHot = false;
                } else {
                    // Give up and return null
                    return null;
                }
            }
        }

        return $manifest;
    }
1103380
public function when(string $type, array $config = []): self
    {
        if (! isset($this->data['on'][$type])) {
            $this->data['on'][$type] = [];
        }

        $this->data['on'][$type] = \array_merge($this->data['on'][$type], $config);

        return $this;
    }
372907
public static function reader($config = null, $default = false) {
		if (empty($config)) {
			$config = array(
				'id' => 'json',
				'className' => 'JsonReader',
				'location' => 'Common.Configure'
			);
		}

		if (!is_array($config)) {
			$config = array(
				'id' => $config,
				'className' => ucfirst($config) . 'Reader',
				'location' => 'Configure'
			);
		}

		extract($config);

		if (Configure::configured($id)) {
			throw new ConfigureException(__d('_common_', "A reader with the '%s' name already exists.", $id));
		}

		foreach (array('id', 'className', 'location') as $var) {
			if (!isset($$var) || empty($$var)) {
				throw new ConfigureException(__d('_common_', "Reader configuration missing the '%s' key.", $key));
			}
		}

		App::uses($className, $location);
		Configure::config($default ? 'default' : $id, new $className);

		return $config;
	}
952735
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = $this->getConfigurationInstance();
        if ($configuration) {
            $container->addObjectResource($configuration);
        }

        return $configuration;
    }
895917
public function getPluginForConfigType($config_type) {
    $plugins = [];

    foreach ($this->getDefinitions() as $plugin_id => $plugin) {
      try {
        $instance = $this->createInstance($plugin_id);
      }
      catch (PluginException $exception) {
        continue;
      }

      if ($instance->getConfigType() !== $config_type) {
        continue;
      }
      $plugins[] = [
        'plugin' => $instance,
        'weight' => $instance->weight(),
      ];
    }

    if (empty($plugins)) {
      return NULL;
    }
    usort($plugins, ['\Drupal\Component\Utility\SortArray', 'sortByWeightElement']);
    $data = reset($plugins);

    return $data['plugin'];
  }
166839
static public function config($config = array())
    {
        !empty($config) && self::$config = array_merge(self::$config, $config);
        if (!empty(self::$config['cachepath'])) {
            Cache::$cachepath = self::$config['cachepath'];
        }
        if (empty(self::$config['component_verify_ticket'])) {
            self::$config['component_verify_ticket'] = Cache::get('component_verify_ticket');
        }
        if (empty(self::$config['token']) && !empty(self::$config['component_token'])) {
            self::$config['token'] = self::$config['component_token'];
        }
        if (empty(self::$config['appsecret']) && !empty(self::$config['component_appsecret'])) {
            self::$config['appsecret'] = self::$config['component_appsecret'];
        }
        if (empty(self::$config['encodingaeskey']) && !empty(self::$config['component_encodingaeskey'])) {
            self::$config['encodingaeskey'] = self::$config['component_encodingaeskey'];
        }
        return self::$config;
    }
353454
protected function getSectionConfig(Config $config, $section)
    {
        $string = '';
        if (isset($config[$section])) {
            /** @var Config $config */
            $config = $config[$section];
            // If there is at least one section
            if ($config->count() > 0) {
                /** @var Config $values */
                foreach ($config as $name => $values) {
                    if ($values->count() > 0) {
                        $string .= $this->sections[$section] . ' ' . $name . PHP_EOL . '{' . PHP_EOL . "\t";
                        $string .= $this->getValuesString($values->toArray());
                        $string .= PHP_EOL . '}' . PHP_EOL;
                    }
                }
            }
        }
        return $string;
    }
963119
public static function config($config = null)
	{
		if(is_array($config)) {

            # Setting Configurations
			static::$config = $config + static::$config;
			$pathWithoutTrailingSlash = rtrim(static::$config['directory'], '/');
			static::$config['directory'] = $pathWithoutTrailingSlash.'/';

		} elseif(is_string($config)) {

            # Getting Single Config item
			return isset(static::$config[$config]) ? static::$config[$config] : null;

		} elseif(!$config) {

            # Getting All configurations
			return static::$config;
		} else {
			throw new CacheException('Invalid parameter provided for Cache::config()');
		}
	}
1014651
public function merge(array $config, $type)
    {
        foreach ($config as $key => $val) {
            $this->set($key, $val, $type);
        }
    }