/**
  * Constructs a configuration wrapper object.
  *
  * @param \Drupal\Core\TypedData\DataDefinitionInterface $definition
  *   The data definition.
  * @param string $name
  *   The configuration object name.
  * @param string $langcode
  *   Language code for the source configuration data.
  * @param \Drupal\locale\LocaleConfigManager $locale_config
  *   The locale configuration manager object.
  * @param \Drupal\locale\TypedConfigManagerInterface $typed_config;
  *   The typed configuration manager interface.
  */
 public function __construct(DataDefinitionInterface $definition, $name, $langcode, LocaleConfigManager $locale_config, TypedConfigManagerInterface $typed_config)
 {
     parent::__construct($definition, $name);
     $this->langcode = $langcode;
     $this->localeConfig = $locale_config;
     $this->typedConfigManager = $typed_config;
 }
 /**
  * Helper method to check data type.
  *
  * @param string $key
  *   A string of configuration key.
  * @param mixed $value
  *   Value of given key.
  *
  * @return array
  *   List of errors found while checking with the corresponding schema.
  */
 protected function checkValue($key, $value)
 {
     $error_key = $this->configName . ':' . $key;
     $element = $this->schema->get($key);
     if ($element instanceof Undefined) {
         // @todo Temporary workaround for https://www.drupal.org/node/2224761.
         $key_parts = explode('.', $key);
         if (array_pop($key_parts) == 'translation_sync' && strpos($this->configName, 'field.') === 0) {
             return array();
         }
         return array($error_key => 'Missing schema.');
     }
     // Do not check value if it is defined to be ignored.
     if ($element && $element instanceof Ignore) {
         return array();
     }
     if ($element && is_scalar($value) || $value === NULL) {
         $success = FALSE;
         $type = gettype($value);
         if ($element instanceof PrimitiveInterface) {
             $success = $type == 'integer' && $element instanceof IntegerInterface || $type == 'double' && $element instanceof FloatInterface || $type == 'boolean' && $element instanceof BooleanInterface || $type == 'string' && $element instanceof StringInterface || $value === NULL;
         }
         $class = get_class($element);
         if (!$success) {
             return array($error_key => "Variable type is {$type} but applied schema class is {$class}.");
         }
     } else {
         $errors = array();
         if (!$element instanceof ArrayElement) {
             $errors[$error_key] = 'Non-scalar value but not defined as an array (such as mapping or sequence).';
         }
         // Go on processing so we can get errors on all levels. Any non-scalar
         // value must be an array so cast to an array.
         if (!is_array($value)) {
             $value = (array) $value;
         }
         // Recurse into any nested keys.
         foreach ($value as $nested_value_key => $nested_value) {
             $errors = array_merge($errors, $this->checkValue($key . '.' . $nested_value_key, $nested_value));
         }
         return $errors;
     }
     // No errors found.
     return array();
 }
 /**
  * Helper method to check data type.
  *
  * @param string $key
  *   A string of configuration key.
  * @param mixed $value
  *   Value of given key.
  *
  * @return array
  *   List of errors found while checking with the corresponding schema.
  */
 protected function checkValue($key, $value)
 {
     $error_key = $this->configName . ':' . $key;
     $element = $this->schema->get($key);
     if ($element instanceof Undefined) {
         return array($error_key => 'missing schema');
     }
     // Do not check value if it is defined to be ignored.
     if ($element && $element instanceof Ignore) {
         return array();
     }
     if ($element && is_scalar($value) || $value === NULL) {
         $success = FALSE;
         $type = gettype($value);
         if ($element instanceof PrimitiveInterface) {
             $success = $type == 'integer' && $element instanceof IntegerInterface || ($type == 'double' || $type == 'integer') && $element instanceof FloatInterface || $type == 'boolean' && $element instanceof BooleanInterface || $type == 'string' && $element instanceof StringInterface || $value === NULL;
         } elseif ($element instanceof ArrayElement && $element->isNullable() && $value === NULL) {
             $success = TRUE;
         }
         $class = get_class($element);
         if (!$success) {
             return array($error_key => "variable type is {$type} but applied schema class is {$class}");
         }
     } else {
         $errors = array();
         if (!$element instanceof TraversableTypedDataInterface) {
             $errors[$error_key] = 'non-scalar value but not defined as an array (such as mapping or sequence)';
         }
         // Go on processing so we can get errors on all levels. Any non-scalar
         // value must be an array so cast to an array.
         if (!is_array($value)) {
             $value = (array) $value;
         }
         // Recurse into any nested keys.
         foreach ($value as $nested_value_key => $nested_value) {
             $errors = array_merge($errors, $this->checkValue($key . '.' . $nested_value_key, $nested_value));
         }
         return $errors;
     }
     // No errors found.
     return array();
 }