DatabaseMysqlBase visibility cleanups
[mediawiki.git] / includes / libs / composer / ComposerLock.php
blob818ccdf3a2db0e2271435b1d8554b76767fcd44e
1 <?php
3 /**
4 * Reads a composer.lock file and provides accessors to get
5 * its hash and what is installed
7 * @since 1.25
8 */
9 class ComposerLock {
11 /**
12 * @param string $location
14 public function __construct( $location ) {
15 $this->contents = json_decode( file_get_contents( $location ), true );
18 /**
19 * Dependencies currently installed according to composer.lock
21 * @return array
23 public function getInstalledDependencies() {
24 $deps = [];
25 foreach ( $this->contents['packages'] as $installed ) {
26 $deps[$installed['name']] = [
27 'version' => ComposerJson::normalizeVersion( $installed['version'] ),
28 'type' => $installed['type'],
29 'licenses' => isset( $installed['license'] ) ? $installed['license'] : [],
30 'authors' => isset( $installed['authors'] ) ? $installed['authors'] : [],
31 'description' => isset( $installed['description'] ) ? $installed['description']: '',
35 return $deps;