function DrupalCoreComposer::loadJsonFromPath

Same name in other branches
  1. 9 composer/Generator/Util/DrupalCoreComposer.php \Drupal\Composer\Generator\Util\DrupalCoreComposer::loadJsonFromPath()
  2. 10 composer/Generator/Util/DrupalCoreComposer.php \Drupal\Composer\Generator\Util\DrupalCoreComposer::loadJsonFromPath()
  3. 11.x 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) : [];
}

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