public function writeReport(Report $report): void
    {
        $count = 0;

        $this->output->writeln('');
        $this->output->writeln('<comment>CHECKSTYLE REPORT</comment>');

        $styleMap = [
            Issue::SEVERITY_ERROR   => 'error',
            Issue::SEVERITY_WARNING => 'comment',
            Issue::SEVERITY_INFO    => 'info',
        ];

        foreach ($report->getFiles() as $file) {
            $this->output->writeln("=> <comment>{$file->getFilename()}</comment>.");
            foreach ($file->getIssues() as $issue) {
                $count++;

                $style = $styleMap[$issue->getSeverity()];

                $this->output->writeln(
                    sprintf(
                        '<comment>%4d <%s>%s</%s></comment>',
                        $issue->getLine() ?? 0,
                        $style,
                        $issue->getMessage(),
                        $style
                    )
                );
            }
        }

        $summary = [];

        foreach ($styleMap as $severity => $style) {
            $severityCount = $report->countIssuesBySeverity($severity);
            if ($severityCount > 0) {
                $summary[] = "<comment>$severityCount</comment> {$severity}s";
            }
        }

        $this->output->writeln("");
        $this->output->writeln('<comment>SUMMARY</comment>');
        $this->output->write("<info><comment>$count</comment> issues in total.</info>");

        if ($count > 0) {
            $this->output->writeln(" (" . implode(', ', $summary) . ")");
        }
    }
public function writeReport(Report $report): void
    {
        $count = 0;

        $this->output->writeln('');
        $this->output->writeln('<comment>CHECKSTYLE REPORT</comment>');

        $styleMap = [
            Issue::SEVERITY_ERROR   => 'error',
            Issue::SEVERITY_WARNING => 'comment',
            Issue::SEVERITY_INFO    => 'info',
        ];

        foreach ($report->getFiles() as $file) {
            $this->output->writeln("=> <comment>{$file->getFilename()}</comment>.");
            foreach ($file->getIssues() as $issue) {
                $count++;

                $style = $styleMap[$issue->getSeverity()];

                $this->output->writeln(
                    sprintf(
                        '<comment>%4d <%s>%s</%s></comment>',
                        $issue->getLine() ?? 0,
                        $style,
                        $issue->getMessage(),
                        $style
                    )
                );
            }
        }

        $summary = [];

        foreach ($styleMap as $severity => $style) {
            $severityCount = $report->countIssuesBySeverity($severity);
            if ($severityCount > 0) {
                $summary[] = "<comment>$severityCount</comment> {$severity}s";
            }
        }

        $this->output->writeln("");
        $this->output->writeln('<comment>SUMMARY</comment>');
        $this->output->write("<info><comment>$count</comment> issues in total.</info>");

        if ($count > 0) {
            $this->output->writeln(" (" . implode(', ', $summary) . ")");
        }
    }
public function writeReport ( Report $ report ) : void { $ count = 0 ; $ this -> output -> writeln ( '' ) ; $ this -> output -> writeln ( '<comment>CHECKSTYLE REPORT</comment>' ) ; $ styleMap = [ Issue :: SEVERITY_ERROR => 'error' , Issue :: SEVERITY_WARNING => 'comment' , Issue :: SEVERITY_INFO => 'info' , ] ; foreach ( $ report -> getFiles ( ) as $ file ) { $ this -> output -> writeln ( "=> <comment>{$file->getFilename()}</comment>." ) ; foreach ( $ file -> getIssues ( ) as $ issue ) { $ count ++ ; $ style = $ styleMap [ $ issue -> getSeverity ( ) ] ; $ this -> output -> writeln ( sprintf ( '<comment>%4d <%s>%s</%s></comment>' , $ issue -> getLine ( ) ?? 0 , $ style , $ issue -> getMessage ( ) , $ style ) ) ; } } $ summary = [ ] ; foreach ( $ styleMap as $ severity => $ style ) { $ severityCount = $ report -> countIssuesBySeverity ( $ severity ) ; if ( $ severityCount > 0 ) { $ summary [ ] = "<comment>$severityCount</comment> {$severity}s" ; } } $ this -> output -> writeln ( "" ) ; $ this -> output -> writeln ( '<comment>SUMMARY</comment>' ) ; $ this -> output -> write ( "<info><comment>$count</comment> issues in total.</info>" ) ; if ( $ count > 0 ) { $ this -> output -> writeln ( " (" . implode ( ', ' , $ summary ) . ")" ) ; } }
Writes a report in human-readable table form.

@param Report $report The report to print.
@return void
Writes a report in human - readable table form .