You are here

public static function PackageGenerator::encode in Drupal 10

Same name and namespace in other branches
  1. 8 composer/Generator/PackageGenerator.php \Drupal\Composer\Generator\PackageGenerator::encode()
  2. 9 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";
}