public static function Composer::getJson in Markdown 8.2
Decodes the composer.json file for a given directory and returns its data.
@internal
Parameters
string $directory: The directory where the composer.json file lives.
string $name: (Read-only) The package name, extracted from the JSON data.
Return value
array|void The JSON data of composer.json for the given $directory.
Deprecated
in markdown:8.x-2.0 and is removed from markdown:4.0.0. No replacement.
See also
https://www.drupal.org/project/markdown/issues/3200476
2 calls to Composer::getJson()
- Composer::getJsonFromClass in src/
Util/ Composer.php - Decodes the composer.json file from a given class and returns its data.
- MarkdownCommands::versionHash in src/
Commands/ MarkdownCommands.php - Run the markdown:version-hash hook.
File
- src/
Util/ Composer.php, line 194
Class
- Composer
- Helper class used to deal with composer.
Namespace
Drupal\markdown\UtilCode
public static function getJson($directory, &$name = NULL) {
if (($file = realpath("{$directory}/composer.json")) && ($contents = file_get_contents($file)) && ($json = Json::decode($contents))) {
if (!empty($json['name'])) {
$name = $json['name'];
}
return $json;
}
}