Check config ignore rules.

@param \Drupal\Core\Config\Config $config
Config object.
@param $config_type
Config type.

@return bool
TRUE - if changes can be ignored.
338194
public function validateChanges(Config $config, $config_type) {
    $original = $config->getOriginal();
    $updated = $config->get();
    $ignore_plugin = $this->getPluginForConfigType($config_type);

    if (!$ignore_plugin) {
      // Ignore rules not found for this config type.
      return FALSE;
    }

    if ($ignore_plugin->fullIgnore()) {
      // Ignore any changes for this config type.
      return TRUE;
    }

    // Get config changes.
    $diff = DiffArray::diffAssocRecursive($original, $updated);
    $diff_keys = $this->getModifiedKeys($diff);

    return $ignore_plugin->checkIgnoreDiffKeys($diff_keys);
  }
641332
protected function applyConfig(array $config) : void
    {
        $this->applyRules(ArrayHelper::get($config, 'rules', []));
        $this->applyRoles(ArrayHelper::get($config, 'roles', []));
        $this->applyPermissions(ArrayHelper::get($config, 'permissions', []));
    }
171988
private static function parseConfig($config)
    {
        if (empty($config)) {
            $config = Db::getConfig();
        } elseif (is_string($config) && false === strpos($config, '/')) {
            // 支持读取配置参数
            $config = Db::getConfig($config);
        }

        if (is_string($config)) {
            return self::parseDsnConfig($config);
        } else {
            return $config;
        }
    }
883490
protected function evalConfig($config)
    {
        if (array_key_exists('defaultTab', $config)) {
            $this->defaultTab = $config['defaultTab'];
        }
        
        if (array_key_exists('icons', $config)) {
            $this->icons = $config['icons'];
        }
        
        if (array_key_exists('stretch', $config)) {
            $this->stretch = $config['stretch'];
        }

        if (array_key_exists('suppressTabs', $config)) {
            $this->suppressTabs = $config['suppressTabs'];
        }

        if (array_key_exists('cssClass', $config)) {
            $this->cssClass = $config['cssClass'];
        }

        if (array_key_exists('paneCssClass', $config)) {
            $this->paneCssClass = $config['paneCssClass'];
        }
    }
892398
private static function isConfigApplicableToEnvironment($config): bool
    {
        if (!property_exists($config, "environment") || empty($config->environment)) {
            return true; // no environment filter.
        }
        
        $applicableToEnvs = $config->environment;
        if (is_string($applicableToEnvs)) {
            $applicableToEnvs = explode("|", $applicableToEnvs);
        }
        
        return (ArrayUtils::doesArrayHaveValue($applicableToEnvs, "any", true) || ArrayUtils::doesArrayHaveValue($applicableToEnvs, XENTRIQ_ENVIRONMENT, true));
    }
457685
public static function checkConfig(&$config, $instanceOf = null, $removeClass = true)
    {
        // Get class from config
        $class = static::getClassFromConfig($config, $removeClass);

        // Make sure we have a valid class
        if ($instanceOf && !is_subclass_of($class, $instanceOf)) {
            static::throwInvalidInstanceException($class, $instanceOf);
        }

        return $class;
    }
1210645
public function changeConfig($config)
    {
        if (!is_array($config)) {
            return false;
        }

        $this->config = array_merge($this->config, $config);

        return true;
    }
498786
private function setConfigOptions(array $config_array)
    {
        foreach ($config_array as $type => $value) {
            $this->setConfigOption($type, $value);
        }

        return true;
    }
1024373
protected function checkPermission($type)
    {
        if (isset($this->config[$type]['visible'])) {
            $role = $this->config[$type]['visible'];
            unset($this->config[$type]['visible']);
            if (!Yii::$app->getUser()->can($role)) {
                return false;
            }
        }

        return true;
    }
1041236
protected function checkConfig($config)
    {
        $required_fields = ['namespace', 'table', 'path', 'mapping', 'import_keys'];

        foreach ($required_fields as $key) {
            if (!array_has($config, $key)) {
                $this->error(sprintf('Missing \'%s\' from the dataset configuration file.', $key));
                $this->line('');
                $this->line('');

                exit(1);
            }
        }
    }
753591
public static boolean hasAccess(Config config, int type) {

	boolean has = true;
	if (config instanceof ConfigWeb) {
	    has = ((ConfigWeb) config).getSecurityManager().getAccess(type) != SecurityManager.VALUE_NO;
	}
	return has;
    }
279528
protected function applyCommonConfiguration($config)
    {
        $this->columnName = isset($config['columnName']) ? strval($config['columnName']) : $this->name;

        if (isset($config['visible'])) {
            $this->isVisible = (bool) $config['visible'];
        }
        if (isset($config['readOnly'])) {
            $this->isReadOnly = (bool) $config['readOnly'];
        }
        if (isset($config['defaultValue'])) {
            $this->defaultValue = $config['defaultValue'];
        }
        if (isset($config['accessor'])) {
            $this->accessor = strval($config['accessor']);
        }
        if (isset($config['mutator'])) {
            $this->mutator = strval($config['mutator']);
        }

        if (isset($config['validators'])) {
            $validators = $config['validators'];
            if (!is_array($validators)) {
                throw new UnexpectedValueException($this->translate(
                    'Field validators configuration should be an array.'
                ));
            }
            $this->validators = $validators;
        }

        if (isset($config['filters'])) {
            $filters = $config['filters'];
            if (!is_array($filters)) {
                throw new UnexpectedValueException($this->translate(
                    'Field filters configuration should be an array.'
                ));
            }
            $this->filters = $filters;
        }
    }
1224131
protected function doSetup($config = array())
    {
        // Catch the configuration file path
        if (isset($config[self::CONFIG_KEY_FILE_PATH])) {
            $this->configFilePath = $config[self::CONFIG_KEY_FILE_PATH];
        } else {
            // Also consider throwing an exception here instead
            // of failing silently
            return $config;
        }

        // Catch the context
        if (isset($config[ConfigInterface::KEY_CONTEXT])) {
            $this->context = $config[ConfigInterface::KEY_CONTEXT];
        }

        return $this->readConfigurationFiles();
    }
662413
private function loadConfigType($config_type)
    {
        // Get Path for config
        if ($config_type === 'default') {
            $config_path = self::DEFAULT_CONFIG_PATH;
        } else {
            $config_path = self::DEFAULT_CONFIG_MESSAGE_TYPE_PATH.'.'.$config_type;
        }

        $config_array = $this->config->get($config_path);

        if (is_null($config_array)) {
            throw new UnknownMessageTypeException('Pigeon config not found for type: '.$config_type);
        }

        if (!is_array($config_array)) {
            throw new InvalidMessageTypeException('Pigeon config not set up properly for type: '.$config_type);
        }

        if($this->setConfigOptions($config_array)) {
            $this->message_type = $config_type;
        }

        return true;

    }
1213305
public static function findClassFromConfig(&$config, bool $removeClass = false)
    {
        // Normalize the config
        if (is_string($config)) {
            // Set as class
            $class = $config;

            // Clear class from config
            $config = '';
        } elseif (is_object($config)) {
            return get_class($config);
        } else {
            // Force Array
            if (!is_array($config)) {
                $config = ArrayHelper::toArray($config, [], false);
            }

            if ($removeClass) {
                if (!$class = ArrayHelper::remove($config, 'class')) {
                    $class = ArrayHelper::remove($config, 'type');
                }
            } else {
                $class = ArrayHelper::getValue(
                    $config,
                    'class',
                    ArrayHelper::getValue($config, 'type')
                );
            }
        }

        return $class;
    }
539856
public function configure(Config $config)
    {
        $this->log_format    = $config->getString('log_format',self::DEFAULT_LOG_FORMAT);
        $this->log_encoding  = $config->getString('log_encoding','utf8');
        $this->log_levels    = $config->getList('log_levels',['T','D','I','W','E','F']);
    }
794438
def is_config_type(type_):
    

    return (
        isinstance(type_, type)
        and hasattr(type_, "__attrs_attrs__")
        and hasattr(type_, CONFIG_KEY)
    )