@@ -83,33 +83,23 @@ public function __construct(ModuleList\Loader $loader, Dir\Reader $reader, Strin
83
83
private function load ()
84
84
{
85
85
if ($ this ->packageModuleMap === null ) {
86
- /**
87
- * array keys: module name in module.xml; array values: raw content from composer.json
88
- * this raw data is used to create a dependency graph and also a package name-module name mapping
89
- */
90
- $ rawData = [];
91
86
$ jsonData = $ this ->reader ->getComposerJsonFiles ()->toArray ();
92
87
foreach (array_keys ($ this ->loader ->load ()) as $ moduleName ) {
93
88
$ key = $ this ->string ->upperCaseWords ($ moduleName , '_ ' , '/ ' ) . '/composer.json ' ;
94
89
if (isset ($ jsonData [$ key ])) {
95
- $ rawData [$ moduleName ] = $ jsonData [$ key ];
96
- } else {
97
- $ rawData [$ moduleName ] = '{} ' ;
98
- }
99
- }
100
- foreach ($ rawData as $ moduleName => $ jsonData ) {
101
- $ jsonData = \Zend_Json::decode ($ jsonData );
102
- if (isset ($ jsonData ['name ' ])) {
103
- $ this ->packageModuleMap [$ jsonData ['name ' ]] = $ moduleName ;
104
- }
105
- if (isset ($ jsonData ['version ' ])) {
106
- $ this ->modulePackageVersionMap [$ moduleName ] = $ jsonData ['version ' ];
107
- }
108
- if (!empty ($ jsonData ['require ' ])) {
109
- $ this ->requireMap [$ moduleName ] = array_keys ($ jsonData ['require ' ]);
110
- }
111
- if (!empty ($ jsonData ['conflict ' ])) {
112
- $ this ->conflictMap [$ moduleName ] = $ jsonData ['conflict ' ];
90
+ $ packageData = \Zend_Json::decode ($ jsonData [$ key ]);
91
+ if (isset ($ packageData ['name ' ])) {
92
+ $ this ->packageModuleMap [$ packageData ['name ' ]] = $ moduleName ;
93
+ }
94
+ if (isset ($ packageData ['version ' ])) {
95
+ $ this ->modulePackageVersionMap [$ moduleName ] = $ packageData ['version ' ];
96
+ }
97
+ if (!empty ($ packageData ['require ' ])) {
98
+ $ this ->requireMap [$ moduleName ] = array_keys ($ packageData ['require ' ]);
99
+ }
100
+ if (!empty ($ packageData ['conflict ' ])) {
101
+ $ this ->conflictMap [$ moduleName ] = $ packageData ['conflict ' ];
102
+ }
113
103
}
114
104
}
115
105
}
0 commit comments