protected function execute(InputInterface $input, OutputInterface $output)
{
$projectUuid = $input->getArgument('project-uuid');
$api = $this->getApplication()->getApi();
$analysis = $api->analyze($projectUuid, $input->getOption('reference'));
$chars = array('-', '\\', '|', '/');
$position = 0;
while (true) {
// we don't check the status too often
if (0 == $position % 2) {
$analysis = $api->getAnalysisStatus($projectUuid, $analysis->getNumber());
}
if ('txt' === $input->getOption('format')) {
$output->write(sprintf("%s %-80s\r", $chars[$position % 4], $analysis->getStatusMessage()));
}
if ($analysis->isFinished()) {
break;
}
usleep(200000);
++$position;
}
$analysis = $api->getAnalysis($projectUuid, $analysis->getNumber());
if ($analysis->isFailed()) {
$output->writeln(sprintf('There was an error: "%s"', $analysis->getFailureMessage()));
return 1;
}
$helper = new DescriptorHelper($api->getSerializer());
$helper->describe($output, $analysis, $input->getOption('format'), $input->getOption('show-ignored-violations'));
if ('txt' === $input->getOption('format') && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) {
$output->writeln('');
$output->writeln(sprintf('Run <comment>%s %s %s -v</comment> to get the full report', $_SERVER['PHP_SELF'], 'analysis', $projectUuid));
}
}