diff --git a/src/ConfigurationItem.php b/src/ConfigurationItem.php index cc2a9be..cccc24a 100644 --- a/src/ConfigurationItem.php +++ b/src/ConfigurationItem.php @@ -96,29 +96,19 @@ class ConfigurationItem { * Creates a new ConfigurationItem instance. * * @param string $name + * The config name. * @param array $data - * @param string $shortName - * @param string $label - * @param string $type - * @param \string[] $dependents - * @param string $subdirectory - * @param string $package - * @param bool $extensionProvided - * @param string $providingFeature - * @param \string[] $packageExcluded + * The config data. + * @param array $additional_properties + * (optional) Additional properties set on the object. */ - public function __construct($name, array $data, $shortName, $label, $type, array $dependents, $subdirectory, $package, $extensionProvided, $providingFeature, array $packageExcluded = []) { + public function __construct($name, array $data, array $additional_properties = []) { $this->name = $name; - $this->shortName = $shortName; - $this->label = $label; - $this->type = $type; $this->data = $data; - $this->dependents = $dependents; - $this->subdirectory = $subdirectory; - $this->package = $package; - $this->extensionProvided = $extensionProvided; - $this->providingFeature = $providingFeature; - $this->packageExcluded = $packageExcluded; + + foreach ($additional_properties as $property => $value) { + $this->{$property} = $value; + } } /** diff --git a/src/FeaturesManager.php b/src/FeaturesManager.php index 31c449f..42ea8c4 100644 --- a/src/FeaturesManager.php +++ b/src/FeaturesManager.php @@ -953,19 +953,18 @@ class FeaturesManager implements FeaturesManagerInterface { } } - $config_collection[$name] = new ConfigurationItem( - $name, - $data, - $item_name, - $label, - $config_type, - array_keys($dependents), - InstallStorage::CONFIG_INSTALL_DIRECTORY, - '', - NULL, - isset($existing_config[$name]) ? $existing_config[$name] : NULL, - [] - ); + $config_collection[$name] = (new ConfigurationItem($name, $data, [ + 'name_short' => $item_name, + 'label' => $label, + 'type' => $config_type, + 'dependents' => array_keys($dependents), + // Default to the install directory. + 'subdirectory' => InstallStorage::CONFIG_INSTALL_DIRECTORY, + 'package' => '', + 'extension_provided' => NULL, + 'providing_feature' => isset($existing_config[$name]) ? $existing_config[$name] : NULL, + 'package_excluded' => [], + ])); } } $this->setConfigCollection($config_collection);