DrushReporter.php 675 B

12345678910111213141516171819202122232425262728293031
  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. }