File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/Impact/Embodied/Boavizta Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -123,21 +123,25 @@ protected function query($description): array
123123 protected function parseResponse (array $ response ): array
124124 {
125125 $ impacts = [];
126+ $ types = Type::getImpactTypes ();
126127 foreach ($ response ['impacts ' ] as $ type => $ impact ) {
127- if (!in_array ($ type , Type:: getImpactTypes () )) {
128+ if (!in_array ($ type , $ types )) {
128129 trigger_error (sprintf ('Unsupported impact type %s in class %s ' , $ type , __CLASS__ ));
129130 continue ;
130131 }
131-
132+ $ impact_id = Type::getImpactId ($ type );
133+ if ($ impact_id === false ) {
134+ continue ;
135+ }
132136 switch ($ type ) {
133137 case 'gwp ' :
134- $ impacts [Type:: IMPACT_GWP ] = $ this ->parseGwp ($ response ['impacts ' ][' gwp ' ]);
138+ $ impacts [$ impact_id ] = $ this ->parseGwp ($ response ['impacts ' ][$ type ]);
135139 break ;
136140 case 'adp ' :
137- $ impacts [Type:: IMPACT_ADP ] = $ this ->parseAdp ($ response ['impacts ' ][' adp ' ]);
141+ $ impacts [$ impact_id ] = $ this ->parseAdp ($ response ['impacts ' ][$ type ]);
138142 break ;
139143 case 'pe ' :
140- $ impacts [Type:: IMPACT_PE ] = $ this ->parsePe ($ response ['impacts ' ][' pe ' ]);
144+ $ impacts [$ impact_id ] = $ this ->parsePe ($ response ['impacts ' ][$ type ]);
141145 break ;
142146 }
143147 }
You can’t perform that action at this time.
0 commit comments