Merge "Import: Handle uploads with sha1 starting with 0 properly"
[mediawiki.git] / includes / libs / composer / ComposerInstalled.php
blob5f87b54b1db8c0b46181ff3c72970c03f331695b
1 <?php
3 /**
4 * Reads an installed.json file and provides accessors to get what is
5 * installed
7 * @since 1.27
8 */
9 class ComposerInstalled {
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 installed.json
21 * @return array
23 public function getInstalledDependencies() {
24 $deps = array();
25 foreach ( $this->contents as $installed ) {
26 $deps[$installed['name']] = array(
27 'version' => ComposerJson::normalizeVersion( $installed['version'] ),
28 'type' => $installed['type'],
29 'licenses' => isset( $installed['license'] ) ? $installed['license'] : array(),
30 'authors' => isset( $installed['authors'] ) ? $installed['authors'] : array(),
31 'description' => isset( $installed['description'] ) ? $installed['description']: '',
35 ksort( $deps );
36 return $deps;