@@ -203,27 +203,38 @@ public function getRecipes(array $operations): array
203
203
$ version = $ version [0 ].'. ' .($ version [1 ] ?? '9999999 ' );
204
204
205
205
foreach (array_reverse ($ recipeVersions ) as $ v => $ endpoint ) {
206
- if (version_compare ($ version , $ v , '>= ' )) {
207
- $ data [ ' locks ' ][ $ package -> getName ()][ ' version ' ] = $ version ;
208
- $ data [ ' locks ' ][ $ package -> getName ()][ ' recipe ' ][ ' version ' ] = $ v ;
206
+ if (version_compare ($ version , $ v , '< ' )) {
207
+ continue ;
208
+ }
209
209
210
- if (null !== $ recipeRef && isset ($ this ->endpoints [$ endpoint ]['_links ' ]['archived_recipes_template ' ])) {
211
- $ urls [] = strtr ($ this ->endpoints [$ endpoint ]['_links ' ]['archived_recipes_template ' ], [
212
- '{package_dotted} ' => str_replace ('/ ' , '. ' , $ package ->getName ()),
213
- '{ref} ' => $ recipeRef ,
214
- ]);
210
+ $ data ['locks ' ][$ package ->getName ()]['version ' ] = $ version ;
211
+ $ data ['locks ' ][$ package ->getName ()]['recipe ' ]['version ' ] = $ v ;
212
+ $ links = $ this ->endpoints [$ endpoint ]['_links ' ];
215
213
216
- break ;
214
+ if (null !== $ recipeRef && isset ($ links ['archived_recipes_template ' ])) {
215
+ if (isset ($ links ['archived_recipes_template_relative ' ])) {
216
+ $ links ['archived_recipes_template ' ] = preg_replace ('{[^/\?]*+(?=\?|$)} ' , $ links ['archived_recipes_template_relative ' ], $ endpoint , 1 );
217
217
}
218
218
219
- $ urls [] = strtr ($ this -> endpoints [ $ endpoint ][ ' _links ' ][ ' recipe_template ' ], [
219
+ $ urls [] = strtr ($ links [ ' archived_recipes_template ' ], [
220
220
'{package_dotted} ' => str_replace ('/ ' , '. ' , $ package ->getName ()),
221
- '{package} ' => $ package ->getName (),
222
- '{version} ' => $ v ,
221
+ '{ref} ' => $ recipeRef ,
223
222
]);
224
223
225
224
break ;
226
225
}
226
+
227
+ if (isset ($ links ['recipes_template_relative ' ])) {
228
+ $ links ['recipes_template ' ] = preg_replace ('{[^/\?]*+(?=\?|$)} ' , $ links ['recipes_template_relative ' ], $ endpoint , 1 );
229
+ }
230
+
231
+ $ urls [] = strtr ($ links ['recipe_template ' ], [
232
+ '{package_dotted} ' => str_replace ('/ ' , '. ' , $ package ->getName ()),
233
+ '{package} ' => $ package ->getName (),
234
+ '{version} ' => $ v ,
235
+ ]);
236
+
237
+ break ;
227
238
}
228
239
229
240
continue ;
0 commit comments