You are here

public static function ConfigPatch::fromArray in Configuration Split 2.0.x

Create an object from an array.

Parameters

array $patch: The array containing added and removed keys.

Return value

static The patch object.

3 calls to ConfigPatch::fromArray()
ConfigPatchMerge::createPatch in src/Config/ConfigPatchMerge.php
Create a patch object given two arrays.
ConfigSplitManager::mergeSplit in src/ConfigSplitManager.php
Merge the config of a split to the transformation storage.
ConfigSplitManager::splitPreview in src/ConfigSplitManager.php
Split the config of a split to the preview storage.

File

src/Config/ConfigPatch.php, line 68

Class

ConfigPatch
The config patch value object.

Namespace

Drupal\config_split\Config

Code

public static function fromArray(array $patch) : self {
  if (!isset($patch['added'], $patch['removed'])) {
    throw new \InvalidArgumentException(sprintf('The array passed to %s must contain the keys "added" and "removed", it contains %s', __METHOD__, implode(', ', array_keys($patch))));
  }
  return new self($patch['added'], $patch['removed']);
}