Symfony\Component\Console\Style\SymfonyStyle::comment PHP Method

comment() public method

Formats a command comment.
public comment ( string | array $message )
$message string | array
    public function comment($message)
    {
        $messages = is_array($message) ? array_values($message) : array($message);

        $this->autoPrependBlock();
        $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
        $this->newLine();
    }

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $pools = array();
     $clearers = array();
     $container = $this->getContainer();
     $cacheDir = $container->getParameter('kernel.cache_dir');
     foreach ($input->getArgument('pools') as $id) {
         $pool = $container->get($id);
         if ($pool instanceof CacheItemPoolInterface) {
             $pools[$id] = $pool;
         } elseif ($pool instanceof Psr6CacheClearer) {
             $clearers[$id] = $pool;
         } else {
             throw new \InvalidArgumentException(sprintf('"%s" is not a cache pool nor a cache clearer.', $id));
         }
     }
     foreach ($clearers as $id => $clearer) {
         $io->comment(sprintf('Calling cache clearer: <info>%s</info>', $id));
         $clearer->clear($cacheDir);
     }
     foreach ($pools as $id => $pool) {
         $io->comment(sprintf('Clearing cache pool: <info>%s</info>', $id));
         $pool->clear();
     }
     $io->success('Cache was successfully cleared.');
 }
All Usage Examples Of Symfony\Component\Console\Style\SymfonyStyle::comment