function OperationData::normalizeScaffoldMetadata

Same name in other branches
  1. 9 composer/Plugin/Scaffold/Operations/OperationData.php \Drupal\Composer\Plugin\Scaffold\Operations\OperationData::normalizeScaffoldMetadata()
  2. 8.9.x composer/Plugin/Scaffold/Operations/OperationData.php \Drupal\Composer\Plugin\Scaffold\Operations\OperationData::normalizeScaffoldMetadata()
  3. 10 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 185

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.