MediaWiki  master
ComposerInstalled.php
Go to the documentation of this file.
1 <?php
2 
13  private $contents;
14 
18  public function __construct( $location ) {
19  $this->contents = json_decode( file_get_contents( $location ), true );
20  }
21 
27  public function getInstalledDependencies() {
28  $deps = [];
29  foreach ( $this->contents as $installed ) {
30  $deps[$installed['name']] = [
31  'version' => ComposerJson::normalizeVersion( $installed['version'] ),
32  'type' => $installed['type'],
33  'licenses' => $installed['license'] ?? [],
34  'authors' => $installed['authors'] ?? [],
35  'description' => $installed['description'] ?? '',
36  ];
37  }
38 
39  ksort( $deps );
40  return $deps;
41  }
42 }
ComposerJson\normalizeVersion
static normalizeVersion( $version)
Strip a leading "v" from the version name.
Definition: ComposerJson.php:46
ComposerInstalled\__construct
__construct( $location)
Definition: ComposerInstalled.php:18
ComposerInstalled\$contents
array[] $contents
Definition: ComposerInstalled.php:13
ComposerInstalled\getInstalledDependencies
getInstalledDependencies()
Dependencies currently installed according to installed.json.
Definition: ComposerInstalled.php:27
ComposerInstalled
Reads an installed.json file and provides accessors to get what is installed.
Definition: ComposerInstalled.php:9