@@ -431,7 +431,7 @@ public function install(Event $event)
431
431
foreach ($ recipes as $ recipe ) {
432
432
if ('install ' === $ recipe ->getJob () && !$ installContribs && $ recipe ->isContrib ()) {
433
433
$ warning = $ this ->io ->isInteractive () ? 'WARNING ' : 'IGNORING ' ;
434
- $ this ->io ->writeError (sprintf (' - <warning> %s </> %s ' , $ warning , $ recipe -> getFormattedOrigin ( )));
434
+ $ this ->io ->writeError (sprintf (' - <warning> %s </> %s ' , $ warning , $ this -> formatOrigin ( $ recipe )));
435
435
$ question = sprintf (' The recipe for this package comes from the "contrib" repository, which is open to community contributions.
436
436
Review the recipe at %s
437
437
@@ -474,7 +474,7 @@ function ($value) {
474
474
475
475
switch ($ recipe ->getJob ()) {
476
476
case 'install ' :
477
- $ this ->io ->writeError (sprintf (' - Configuring %s ' , $ recipe -> getFormattedOrigin ( )));
477
+ $ this ->io ->writeError (sprintf (' - Configuring %s ' , $ this -> formatOrigin ( $ recipe )));
478
478
$ this ->configurator ->install ($ recipe , $ this ->lock , [
479
479
'force ' => $ event instanceof UpdateEvent && $ event ->force (),
480
480
]);
@@ -491,7 +491,7 @@ function ($value) {
491
491
case 'update ' :
492
492
break ;
493
493
case 'uninstall ' :
494
- $ this ->io ->writeError (sprintf (' - Unconfiguring %s ' , $ recipe -> getFormattedOrigin ( )));
494
+ $ this ->io ->writeError (sprintf (' - Unconfiguring %s ' , $ this -> formatOrigin ( $ recipe )));
495
495
$ this ->configurator ->unconfigure ($ recipe , $ this ->lock );
496
496
break ;
497
497
}
@@ -834,6 +834,23 @@ private function initOptions(): Options
834
834
return new Options ($ options , $ this ->io );
835
835
}
836
836
837
+ private function formatOrigin (Recipe $ recipe ): string
838
+ {
839
+ if (method_exists ($ recipe , 'getFormattedOrigin ' )) {
840
+ return $ recipe ->getFormattedOrigin ();
841
+ }
842
+
843
+ // BC with upgrading from flex < 1.18
844
+ $ origin = $ recipe ->getOrigin ();
845
+
846
+ // symfony/translation:[email protected] /symfony/recipes:branch
847
+ if (!preg_match ('/^([^:]++):([^@]++)@(.+)$/ ' , $ origin , $ matches )) {
848
+ return $ origin ;
849
+ }
850
+
851
+ return sprintf ('<info>%s</> (<comment>>=%s</>): From %s ' , $ matches [1 ], $ matches [2 ], 'auto-generated recipe ' === $ matches [3 ] ? '<comment> ' .$ matches [3 ].'</> ' : $ matches [3 ]);
852
+ }
853
+
837
854
private function shouldRecordOperation (PackageEvent $ event ): bool
838
855
{
839
856
$ operation = $ event ->getOperation ();
0 commit comments