Merge "FauxRequest: don’t override getValues()"
[lhc/web/wiklou.git] / includes / libs / composer / ComposerJson.php
index 49c9f23..f92759b 100644 (file)
@@ -7,29 +7,30 @@
  * @since 1.25
  */
 class ComposerJson {
+       /**
+        * @var array[]
+        */
+       private $contents;
 
        /**
         * @param string $location
         */
        public function __construct( $location ) {
-               $this->hash = md5_file( $location );
                $this->contents = json_decode( file_get_contents( $location ), true );
        }
 
-       public function getHash() {
-               return $this->hash;
-       }
-
        /**
         * Dependencies as specified by composer.json
         *
-        * @return array
+        * @return string[]
         */
        public function getRequiredDependencies() {
-               $deps = array();
-               foreach ( $this->contents['require'] as $package => $version ) {
-                       if ( $package !== "php" ) {
-                               $deps[$package] = self::normalizeVersion( $version );
+               $deps = [];
+               if ( isset( $this->contents['require'] ) ) {
+                       foreach ( $this->contents['require'] as $package => $version ) {
+                               if ( $package !== "php" && strpos( $package, 'ext-' ) !== 0 ) {
+                                       $deps[$package] = self::normalizeVersion( $version );
+                               }
                        }
                }