diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php index e901e05..c9084b7 100644 --- a/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -428,7 +428,7 @@ public function save() { // Ensure that the schema wrapper has the latest data. $this->setSchemaWrapper(); foreach ($this->data as $key => $value) { - $this->data[$key] = $this->getTypedValue($key, $value); + $this->data[$key] = $this->castValue($key, $value); } } @@ -496,11 +496,11 @@ public function merge(array $data_to_merge) { } /** - * Gets the schema for the whole configuration object. + * Gets the schema wrapper for the whole configuration object. * * @return \Drupal\Core\Config\Schema\Element */ - public function getSchemaWrapper() { + protected function getSchemaWrapper() { if (empty($this->schemaWrapper)) { $this->setSchemaWrapper(); } @@ -513,7 +513,7 @@ public function getSchemaWrapper() { * @return \Drupal\Core\Config\Config * The configuration object. */ - public function setSchemaWrapper() { + protected function setSchemaWrapper() { $typed_config_manager = $this->getTypedConfigManager(); $definition = $typed_config_manager->getDefinition($this->name); $this->schemaWrapper = $typed_config_manager->create($definition, $this->data); @@ -528,7 +528,7 @@ public function setSchemaWrapper() { * * @return \Drupal\Core\Config\Schema\Element */ - public function getSchemaForKey($key) { + protected function getSchemaForKey($key) { $parts = explode('.', $key); $schema_wrapper = $this->getSchemaWrapper(); if (count($parts) == 1) { @@ -549,7 +549,7 @@ public function getSchemaForKey($key) { } /** - * Gets the value with the correct data type for this config object. + * Casts the value to correct data type using the configuration schema. * * @param string $key * A string that maps to a key within the configuration data. @@ -559,14 +559,14 @@ public function getSchemaForKey($key) { * @return mixed * The value cast to the type indicated in the schema. */ - public function getTypedValue($key, $value) { + protected function castValue($key, $value) { if (is_scalar($value) || $value === NULL) { try { $class = get_class($this->getSchemaForKey($key)); } catch(\Exception $e) { - // @todo throw an exception due to an incomplete schema once - // https://drupal.org/node/1910624 is complete. + // @todo throw an exception due to an incomplete schema. Only possible + // once https://drupal.org/node/1910624 is complete. $class = FALSE; } switch ($class) { @@ -594,7 +594,7 @@ public function getTypedValue($key, $value) { } // Recurse into any nested keys. foreach ($value as $nested_value_key => $nested_value) { - $value[$nested_value_key] = $this->getTypedValue($key . '.' . $nested_value_key, $nested_value); + $value[$nested_value_key] = $this->castValue($key . '.' . $nested_value_key, $nested_value); } } return $value;