function PackageGenerator::encode

Same name in other branches
  1. 9 composer/Generator/PackageGenerator.php \Drupal\Composer\Generator\PackageGenerator::encode()
  2. 8.9.x composer/Generator/PackageGenerator.php \Drupal\Composer\Generator\PackageGenerator::encode()
  3. 10 composer/Generator/PackageGenerator.php \Drupal\Composer\Generator\PackageGenerator::encode()

Utility function to encode metapackage json in a consistent way.

Parameters

array $composer_json_data: Data to encode into a json string.

Return value

string Encoded version of provided json data.

2 calls to PackageGenerator::encode()
MetapackageUpdateTest::testUpdated in core/tests/Drupal/Tests/Composer/Generator/MetapackageUpdateTest.php
Tests to see if the generated metapackages are in sync with composer.lock.
PackageGenerator::generateMetapackage in composer/Generator/PackageGenerator.php
Generate one metapackage.

File

composer/Generator/PackageGenerator.php, line 123

Class

PackageGenerator
Generates metapackages.

Namespace

Drupal\Composer\Generator

Code

public static function encode($composer_json_data) {
    return json_encode($composer_json_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
}

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