MediaWiki master
ComposerLock.php
Go to the documentation of this file.
1<?php
2
3namespace Wikimedia\Composer;
4
16 private $contents;
17
21 public function __construct( $location ) {
22 $this->contents = json_decode( file_get_contents( $location ), true );
23 }
24
30 public function getInstalledDependencies() {
31 $deps = [];
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'] ?? '',
39 ];
40 }
41
42 return $deps;
43 }
44}
static normalizeVersion( $version)
Strip a leading "v" from the version name.
Reads a composer.lock file and provides accessors to get its hash and what is installed.
getInstalledDependencies()
Dependencies currently installed according to composer.lock.