MediaWiki  master
ComposerLock.php
Go to the documentation of this file.
1 <?php
2 
9 class ComposerLock {
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 }
array [] $contents
-var array{packages:array{name:string,version:string,type:string,license?:string,authors?:mixed,description?:string}}
__construct( $location)
static normalizeVersion( $version)
Strip a leading "v" from the version name.
getInstalledDependencies()
Dependencies currently installed according to composer.lock.
Reads a composer.lock file and provides accessors to get its hash and what is installed.
Definition: ComposerLock.php:9