MediaWiki master
ComposerInstalled.php
Go to the documentation of this file.
1<?php
2
4
15 private $contents;
16
20 public function __construct( $location ) {
21 $this->contents = json_decode( file_get_contents( $location ), true );
22 }
23
29 public function getInstalledDependencies() {
30 $contents = $this->contents['packages'];
31
32 $deps = [];
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'] ?? '',
40 ];
41 }
42
43 ksort( $deps );
44 return $deps;
45 }
46}
Reads an installed.json file and provides accessors to get what is installed.
getInstalledDependencies()
Dependencies currently installed according to installed.json.
static normalizeVersion( $version)
Strip a leading "v" from the version name.