You are here

protected static function DrupalCoreComposer::loadJsonFromPath in Drupal 10

Same name and namespace in other branches
  1. 8 composer/Generator/Util/DrupalCoreComposer.php \Drupal\Composer\Generator\Util\DrupalCoreComposer::loadJsonFromPath()
  2. 9 composer/Generator/Util/DrupalCoreComposer.php \Drupal\Composer\Generator\Util\DrupalCoreComposer::loadJsonFromPath()

Load json data from the specified path.

Parameters

string $path: Relative path to the json file to load.

Return value

array The contents of the json data for the specified file.

1 call to DrupalCoreComposer::loadJsonFromPath()
DrupalCoreComposer::createFromPath in composer/Generator/Util/DrupalCoreComposer.php
DrupalCoreComposer factory.

File

composer/Generator/Util/DrupalCoreComposer.php, line 119

Class

DrupalCoreComposer
Utilities for accessing composer.json data from drupal/drupal and drupal/core.

Namespace

Drupal\Composer\Generator\Util

Code

protected static function loadJsonFromPath($path) {
  return file_exists($path) ? json_decode(file_get_contents($path), TRUE) : [];
}