MediaWiki REL1_37
ComposerLock.php
Go to the documentation of this file.
1<?php
2
14 private $contents;
15
19 public function __construct( $location ) {
20 $this->contents = json_decode( file_get_contents( $location ), true );
21 }
22
28 public function getInstalledDependencies() {
29 $deps = [];
30 foreach ( $this->contents['packages'] as $installed ) {
31 $deps[$installed['name']] = [
32 'version' => ComposerJson::normalizeVersion( $installed['version'] ),
33 'type' => $installed['type'],
34 'licenses' => $installed['license'] ?? [],
35 'authors' => $installed['authors'] ?? [],
36 'description' => $installed['description'] ?? '',
37 ];
38 }
39
40 return $deps;
41 }
42}
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.
__construct( $location)
getInstalledDependencies()
Dependencies currently installed according to composer.lock.
array[] $contents