
| Current Path : /var/www/html/ift/vendor/chi-teck/drupal-code-generator/src/Helper/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/ift/vendor/chi-teck/drupal-code-generator/src/Helper/OutputHandler.php |
<?php
namespace DrupalCodeGenerator\Helper;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Output printer for generators.
*/
class OutputHandler extends Helper {
/**
* {@inheritdoc}
*/
public function getName() {
return 'dcg_output_handler';
}
/**
* Prints summary.
*
* @param \Symfony\Component\Console\Output\OutputInterface $output
* Output instance.
* @param array $dumped_files
* List of created or updated files.
*/
public function printSummary(OutputInterface $output, array $dumped_files) {
if (count($dumped_files) > 0) {
// Multiple hooks can be dumped to the same file.
$dumped_files = array_unique($dumped_files);
usort($dumped_files, function ($a, $b) {
$depth_a = substr_count($a, '/');
$depth_b = substr_count($b, '/');
// Top level files should be printed first.
return $depth_a == $depth_b || ($depth_a > 1 && $depth_b > 1) ?
strcmp($a, $b) : ($depth_a > $depth_b ? 1 : -1);
});
$output->writeln('');
$output->writeln(' The following directories and files have been created or updated:');
$output->writeln('<fg=cyan;options=bold>–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––</>');
foreach ($dumped_files as $file) {
$output->writeln(" • $file");
}
$output->writeln('');
}
}
}