Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify console output mode (verbose) #264

Merged
merged 1 commit into from
Sep 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/Console/Command/AnalyzeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,12 @@ protected function printBanner(OutputInterface $output): void

protected function printCollectViolations(OutputInterface $output): void
{
if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$output->writeln('<info>collecting violations.</info>');
}
$output->writeln('<info>collecting violations.</info>', OutputInterface::VERBOSITY_VERBOSE);
}

protected function printFormattingStart(OutputInterface $output): void
{
if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$output->writeln('<info>formatting dependencies.</info>');
}
$output->writeln('<info>formatting dependencies.</info>', OutputInterface::VERBOSITY_VERBOSE);
}

protected function printFormatterException(OutputInterface $output, string $formatterName, \Exception $exception): void
Expand Down
45 changes: 19 additions & 26 deletions src/Subscriber/ConsoleSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,26 @@ public static function getSubscribedEvents(): array

public function onPreCreateAstMapEvent(PreCreateAstMapEvent $preCreateAstMapEvent): void
{
if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->output->writeln(
sprintf(
'Start to create an AstMap for <info>%u</info> Files.',
$preCreateAstMapEvent->getExpectedFileCount()
)
);
}
$this->output->writeln(
sprintf(
'Start to create an AstMap for <info>%u</info> Files.',
$preCreateAstMapEvent->getExpectedFileCount()
),
OutputInterface::VERBOSITY_VERBOSE
);
}

public function onPostCreateAstMapEvent(PostCreateAstMapEvent $postCreateAstMapEvent): void
{
if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->output->writeln('AstMap created.');
}
$this->output->writeln('AstMap created.', OutputInterface::VERBOSITY_VERBOSE);
}

public function onAstFileAnalyzedEvent(AstFileAnalyzedEvent $analyzedEvent): void
{
if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_VERBOSE) {
$this->output->writeln(sprintf('Parsing File %s', $analyzedEvent->getFile()->getPathname()));
}
$this->output->writeln(
sprintf('Parsing File %s', $analyzedEvent->getFile()->getPathname()),
OutputInterface::VERBOSITY_VERBOSE
);
}

public function onAstFileSyntaxErrorEvent(AstFileSyntaxErrorEvent $astFileSyntaxErrorEvent): void
Expand All @@ -75,29 +73,24 @@ public function onAstFileSyntaxErrorEvent(AstFileSyntaxErrorEvent $astFileSyntax

public function onPreDependencyEmit(PreEmitEvent $event): void
{
if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$this->output->writeln(sprintf('start emitting dependencies <info>"%s"</info>', $event->getEmitterName()));
}
$this->output->writeln(
sprintf('start emitting dependencies <info>"%s"</info>', $event->getEmitterName()),
OutputInterface::VERBOSITY_VERBOSE
);
}

public function onPostDependencyEmit(): void
{
if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$this->output->writeln('<info>end emitting dependencies</info>');
}
$this->output->writeln('<info>end emitting dependencies</info>', OutputInterface::VERBOSITY_VERBOSE);
}

public function onPreDependencyFlatten(): void
{
if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$this->output->writeln('<info>start flatten dependencies</info>');
}
$this->output->writeln('<info>start flatten dependencies</info>', OutputInterface::VERBOSITY_VERBOSE);
}

public function onPostDependencyFlatten(): void
{
if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$this->output->writeln('<info>end flatten dependencies</info>');
}
$this->output->writeln('<info>end flatten dependencies</info>', OutputInterface::VERBOSITY_VERBOSE);
}
}