public function output(OutputInterface $output) { $suggestedChange = $this->report->getSuggestedLevel(); $output->writeln(''); // line clear $output->writeln('Suggested semantic versioning change: ' . Level::toString($suggestedChange)); $contexts = ['class', 'function', 'interface', 'trait']; foreach ($contexts as $context) { $this->outputReport($output, $this->report, $context); } }
public function getOutput() { $output = []; $output['level'] = Level::toString($this->report->getSuggestedLevel()); $output['changes'] = []; $contexts = ['class', 'function', 'interface', 'trait']; $differences = $this->report->getDifferences(); foreach ($contexts as $context) { foreach (Level::asList('desc') as $level) { $reportForLevel = $differences[$context][$level]; /** @var \PHPSemVerChecker\Operation\Operation $operation */ foreach ($reportForLevel as $operation) { $output['changes'][$context][] = ['level' => Level::toString($level), 'location' => $operation->getLocation(), 'line' => $operation->getLine(), 'target' => $operation->getTarget(), 'reason' => $operation->getReason(), 'code' => $operation->getCode()]; } } } return $output; }