You are here

protected function OperationData::normalizeScaffoldMetadata in Drupal 8

Same name and namespace in other branches
  1. 9 composer/Plugin/Scaffold/Operations/OperationData.php \Drupal\Composer\Plugin\Scaffold\Operations\OperationData::normalizeScaffoldMetadata()

Normalizes metadata by converting literal values into arrays.

Conversions performed include:

  • Boolean 'false' means "skip".
  • A string means "replace", with the string value becoming the path.

Parameters

string $destination: The destination path for the scaffold file.

mixed $value: The metadata for this operation object, which varies by operation type.

Return value

array Normalized scaffold metadata with default values.

1 call to OperationData::normalizeScaffoldMetadata()
OperationData::__construct in composer/Plugin/Scaffold/Operations/OperationData.php
OperationData constructor.

File

composer/Plugin/Scaffold/Operations/OperationData.php, line 183

Class

OperationData
Holds parameter data for operation objects during operation creation only.

Namespace

Drupal\Composer\Plugin\Scaffold\Operations

Code

protected function normalizeScaffoldMetadata($destination, $value) {
  $defaultScaffoldMetadata = [
    self::MODE => ReplaceOp::ID,
    self::PREPEND => NULL,
    self::APPEND => NULL,
    self::DEFAULT => NULL,
    self::OVERWRITE => TRUE,
  ];
  return $this
    ->convertScaffoldMetadata($destination, $value) + $defaultScaffoldMetadata;
}