blob: 23d92fe4d6ab5b9576ad6d667a91fe8f81025592 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<?php
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class MyCommand extends Command
{
protected function execute(InputInterface $input, OutputInterface $output): int
{
$ioV = new SymfonyStyle($input, $output->isVerbose() ? $output : new NullOutput());
$ioVV = new SymfonyStyle($input, $output->isVeryVerbose() ? $output : new NullOutput());
$ioVVV = new SymfonyStyle($input, $output->isDebug() ? $output : new NullOutput());
$ioV->writeln('message visible with -v only');
$ioVV->writeln('message visible with -vv only');
$ioVVV->writeln('message visible with -vvv only');
}
}
|