Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MetadataMinifier.php

function MetadataMinifier::expand

Expands an array of minified versions back to their original format

Parameters

array[] $versions A list of minified version arrays:

Return value

array[] A list of version arrays

1 call to MetadataMinifier::expand()
ComposerRepository::loadAsyncPackages in vendor/composer/composer/src/Composer/Repository/ComposerRepository.php
@phpstan-param array<key-of<BasePackage::STABILITIES>, BasePackage::STABILITY_*>|null $acceptableStabilities

File

vendor/composer/metadata-minifier/src/MetadataMinifier.php, line 22

Class

MetadataMinifier

Namespace

Composer\MetadataMinifier

Code

public static function expand(array $versions) {
    $expanded = array();
    $expandedVersion = null;
    foreach ($versions as $versionData) {
        if (!$expandedVersion) {
            $expandedVersion = $versionData;
            $expanded[] = $expandedVersion;
            continue;
        }
        // add any changes from the previous version to the expanded one
        foreach ($versionData as $key => $val) {
            if ($val === '__unset') {
                unset($expandedVersion[$key]);
            }
            else {
                $expandedVersion[$key] = $val;
            }
        }
        $expanded[] = $expandedVersion;
    }
    return $expanded;
}
RSS feed
Powered by Drupal