DrushReporter.php 673 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Fgm\ComposerCheck;
  3. /**
  4. * Class YamlReporter formats a requirements set as a console table.
  5. */
  6. class DrushReporter extends ReporterBase {
  7. /**
  8. * {@inheritdoc}
  9. */
  10. public function report(MergeBox $mergeBox): string {
  11. $header = ['Name', 'Kind', 'Requirement', 'Version'];
  12. $rows = [$header];
  13. foreach ($mergeBox->getRows() as $kind => $kindPackages) {
  14. foreach ($kindPackages as $package => $info) {
  15. $rows["$package/$kind"] = [
  16. $package,
  17. $kind,
  18. $info['requirement'] ?? '',
  19. $info['version'] ?? '',
  20. ];
  21. }
  22. }
  23. ksort($rows);
  24. drush_print_table($rows, FALSE);
  25. }
  26. }