3 namespace Wikimedia\Composer
;
6 * Reads an installed.json file and provides accessors to get what is
11 class ComposerInstalled
{
18 * @param string $location
20 public function __construct( $location ) {
21 $this->contents
= json_decode( file_get_contents( $location ), true );
25 * Dependencies currently installed according to installed.json
29 public function getInstalledDependencies() {
30 $contents = $this->contents
['packages'];
33 foreach ( $contents as $installed ) {
34 $deps[$installed['name']] = [
35 'version' => ComposerJson
::normalizeVersion( $installed['version'] ),
36 'type' => $installed['type'],
37 'licenses' => $installed['license'] ??
[],
38 'authors' => $installed['authors'] ??
[],
39 'description' => $installed['description'] ??
'',