Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/ Replace with: '\1 ?? ' (Everywhere except includes/PHPVersionCheck.php) (Then, manually fix some line length and indentation issues) Then manually reviewed the replacements for cases where confusing operator precedence would result in incorrect results (fixing those in I478db046a1cc162c6767003ce45c9b56270f3372). Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
38 lines
843 B
PHP
38 lines
843 B
PHP
<?php
|
|
|
|
/**
|
|
* Reads an installed.json file and provides accessors to get what is
|
|
* installed
|
|
*
|
|
* @since 1.27
|
|
*/
|
|
class ComposerInstalled {
|
|
|
|
/**
|
|
* @param string $location
|
|
*/
|
|
public function __construct( $location ) {
|
|
$this->contents = json_decode( file_get_contents( $location ), true );
|
|
}
|
|
|
|
/**
|
|
* Dependencies currently installed according to installed.json
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getInstalledDependencies() {
|
|
$deps = [];
|
|
foreach ( $this->contents as $installed ) {
|
|
$deps[$installed['name']] = [
|
|
'version' => ComposerJson::normalizeVersion( $installed['version'] ),
|
|
'type' => $installed['type'],
|
|
'licenses' => $installed['license'] ?? [],
|
|
'authors' => $installed['authors'] ?? [],
|
|
'description' => $installed['description'] ?? '',
|
|
];
|
|
}
|
|
|
|
ksort( $deps );
|
|
return $deps;
|
|
}
|
|
}
|