3 namespace Wikimedia\Composer
;
6 * Reads a composer.lock file and provides accessors to get
7 * its hash and what is installed
14 * @phan-var array{packages:array{name:string,version:string,type:string,license?:string,authors?:mixed,description?:string}}
19 * @param string $location
21 public function __construct( $location ) {
22 $this->contents
= json_decode( file_get_contents( $location ), true );
26 * Dependencies currently installed according to composer.lock
30 public function getInstalledDependencies() {
32 foreach ( $this->contents
['packages'] as $installed ) {
33 $deps[$installed['name']] = [
34 'version' => ComposerJson
::normalizeVersion( $installed['version'] ),
35 'type' => $installed['type'],
36 'licenses' => $installed['license'] ??
[],
37 'authors' => $installed['authors'] ??
[],
38 'description' => $installed['description'] ??
'',